Splicing - PowerPoint PPT Presentation

1 / 8
About This Presentation
Title:

Splicing

Description:

Sound sound1 = new Sound(FileChooser.getMediaPath('guzdial.wav' ... 'sec3silence.wav'); Sound target = new Sound(silence); target.explore(); target.splice ... – PowerPoint PPT presentation

Number of Views:31
Avg rating:3.0/5.0
Slides: 9
Provided by: BenSc
Category:
Tags: sounds | splicing | wav

less

Transcript and Presenter's Notes

Title: Splicing


1
Session 31
  • Splicing

2
Splicing Sounds Together
  • Originally meant cutting the sound tape into
    segments and then assembling them in the right
    order
  • Easy to do digitally
  • Copy more then one sound into a target sound
  • Track the source index and target index

3
Splice Method in your book
  • public void splice()
  • Sound sound1 new Sound(FileChooser.getMediaP
    ath(guzdial.wav))
  • Sound sound2 new Sound(FileChooser.getMediaP
    ath("is.wav"))
  • int targetIndex 0 // the starting place on
    the target
  • int value 0
  • // copy all of sound 1 into the current sound
    (target)
  • for (int i 0
  • i lt sound1.getLength()
  • i, targetIndex)
  • value sound1.getSampleValueAt(i)
  • this.setSampleValueAt(targetIndex,value)

4
Splice Method - Continued
  • // create silence between words by setting
    values to 0
  • for (int i 0
  • i lt (int) (this.getSamplingRate()
    0.1)
  • i, targetIndex)
  • this.setSampleValueAt(targetIndex,0)
  • // copy all of sound 2 into the current sound
    (target)
  • for (int i 0
  • i lt sound2.getLength()
  • i, targetIndex)
  • value sound2.getSampleValueAt(i)
  • this.setSampleValueAt(targetIndex,value)

5
Testing the Splice Method
  • String silence FileChooser.getMediaPath(
  • "sec3silence.wav")
  • Sound target new Sound(silence)
  • target.explore()
  • target.splice()
  • target.explore()

6
My Splice method
  • public static Sound splice(Sound first,Sound
    second)
  • Sound output new Sound(first.getLength()
    second.getLength())
  • for (int i0iltfirst.getLength()i)
  • output.setSampleValueAt(i,first.getSampleVal
    ueAt(i))
  • for (int i0iltsecond.getLength()i)
  • output.setSampleValueAt(ifirst.getLength()
    ,
  • second.getSampleValueAt(i) )
  • return output

7
So lets test this
  • Sound s new Sound( FileChooser.getMediaPath(c
    raig.wav))
  • Sound front s.clip(0,xxx)
  • Sound back s.clip (yyy,s.getLength()-1)
  • Sound merged Sound.splice(front,back)
  • merged.explore()

8
Hmm, that doesnt sound right
Write a Comment
User Comments (0)
About PowerShow.com