SamplingSampling plays back samples of the original tone.plays back samples of the original tone....

22

Transcript of SamplingSampling plays back samples of the original tone.plays back samples of the original tone....

Page 1: SamplingSampling plays back samples of the original tone.plays back samples of the original tone. For simple decaying tones (e.g., piano, harp, marimba,
Page 2: SamplingSampling plays back samples of the original tone.plays back samples of the original tone. For simple decaying tones (e.g., piano, harp, marimba,

SamplingSamplingSamplingSampling• plays back samples of the original tone. plays back samples of the original tone.

• For simple decaying tones (e.g., piano, harp, marimba, For simple decaying tones (e.g., piano, harp, marimba, guitar, plucked strings), playing back the samples from guitar, plucked strings), playing back the samples from start to finish works well:start to finish works well:

[iv:73] sample of piano Bb3 tone, 9.33 seconds

Page 3: SamplingSampling plays back samples of the original tone.plays back samples of the original tone. For simple decaying tones (e.g., piano, harp, marimba,

Sampling (Soundin)Sampling (Soundin)Sampling (Soundin)Sampling (Soundin)

• soundin:soundin:• Easiest for sounds which don't need to change Easiest for sounds which don't need to change

pitchpitch• percussion (such as drums)percussion (such as drums)• [iv:74][iv:74] speech and sound effects speech and sound effects

Page 4: SamplingSampling plays back samples of the original tone.plays back samples of the original tone. For simple decaying tones (e.g., piano, harp, marimba,

Sampling (Soundin)Sampling (Soundin)Sampling (Soundin)Sampling (Soundin)

• Find a sample or record a sound.Find a sample or record a sound.• To save disk space, change the sampling rate To save disk space, change the sampling rate

to 22050 (using a sound editor such as to 22050 (using a sound editor such as CoolEdit) and change the signal to monoCoolEdit) and change the signal to mono

• Save the soundfile in Mac aiff formatSave the soundfile in Mac aiff format• use the name soundin.# (where the # is some use the name soundin.# (where the # is some

number you give the soundfile)number you give the soundfile)

Page 5: SamplingSampling plays back samples of the original tone.plays back samples of the original tone. For simple decaying tones (e.g., piano, harp, marimba,

Sampling (Soundin)Sampling (Soundin)Sampling (Soundin)Sampling (Soundin)

• Find a sample or record a sound.Find a sample or record a sound.• Using the sound editor, delete any long Using the sound editor, delete any long

silences in the sound and find the beginning silences in the sound and find the beginning and ending times for the sound.and ending times for the sound.

[iv:75] 2.43-second trumpet tone (ctpt03)

Page 6: SamplingSampling plays back samples of the original tone.plays back samples of the original tone. For simple decaying tones (e.g., piano, harp, marimba,

Sampling (Soundin)Sampling (Soundin)Sampling (Soundin)Sampling (Soundin)

• In the Csound score file, the "skip" time is In the Csound score file, the "skip" time is the beginning time for the sound, and the the beginning time for the sound, and the duration of the sound is the ending time duration of the sound is the ending time minus the skip time.minus the skip time.

• The following code reads a mono soundfile:The following code reads a mono soundfile:

asig soundin isoundfile, iskip, iformat

• 0 is default format, 3 is mulaw0 is default format, 3 is mulaw• soundfile should be in Mac aiff formatsoundfile should be in Mac aiff format

Page 7: SamplingSampling plays back samples of the original tone.plays back samples of the original tone. For simple decaying tones (e.g., piano, harp, marimba,

Sampling (Soundin)Sampling (Soundin)Sampling (Soundin)Sampling (Soundin)

• Most of the signal-modifying effects can Most of the signal-modifying effects can modify the sampled signal. These include modify the sampled signal. These include spatialization (stereo, echo, reverb and spatialization (stereo, echo, reverb and amplitude control), ring modulation, amplitude control), ring modulation, flanging and chorus.flanging and chorus.• Example: Example: [iv:76][iv:76] Ayers, Ayers, Long Time No SeeLong Time No See

• But we cannot loop soundin, and we cannot But we cannot loop soundin, and we cannot use it with effects involving frequency use it with effects involving frequency changes, such as vibrato, glissando and changes, such as vibrato, glissando and pitch transposition.pitch transposition.

Page 8: SamplingSampling plays back samples of the original tone.plays back samples of the original tone. For simple decaying tones (e.g., piano, harp, marimba,

LoopingLoopingLoopingLooping

• For sustaining instruments such as the For sustaining instruments such as the winds and bowed strings (e.g., trumpet, winds and bowed strings (e.g., trumpet, flute, violin and organ), the samples must flute, violin and organ), the samples must be looped to allow the tone to keep be looped to allow the tone to keep sustaining:sustaining:

[iv:77] 2.43-second trumpet tone (ctpt03)

Page 9: SamplingSampling plays back samples of the original tone.plays back samples of the original tone. For simple decaying tones (e.g., piano, harp, marimba,

LoopingLoopingLoopingLooping

• For a small loop of exactly one period of a For a small loop of exactly one period of a waveform, sampling is equivalent to waveform, sampling is equivalent to wavetable synthesis. wavetable synthesis.

Page 10: SamplingSampling plays back samples of the original tone.plays back samples of the original tone. For simple decaying tones (e.g., piano, harp, marimba,

LoopingLoopingLoopingLooping

• Making a good loop is not easy.Making a good loop is not easy.• Criteria for good loop points:Criteria for good loop points:

• Loop points should be at zero-crossings to Loop points should be at zero-crossings to avoid discontinuities.avoid discontinuities.

• Waveform at loop points should have similar Waveform at loop points should have similar peak amplitudes.peak amplitudes.

• Waveform at loop points should have similar Waveform at loop points should have similar shapes (and phases).shapes (and phases).

• Pick loop points as far apart as possible Pick loop points as far apart as possible where these criteria are still satisfied.where these criteria are still satisfied.

Page 11: SamplingSampling plays back samples of the original tone.plays back samples of the original tone. For simple decaying tones (e.g., piano, harp, marimba,

Picking Loop PointsPicking Loop PointsPicking Loop PointsPicking Loop Points

• Loop points should be at zero crossings to Loop points should be at zero crossings to avoid discontinuities.avoid discontinuities.

Page 12: SamplingSampling plays back samples of the original tone.plays back samples of the original tone. For simple decaying tones (e.g., piano, harp, marimba,

Picking Loop PointsPicking Loop PointsPicking Loop PointsPicking Loop Points

• Zero-crossings are easy to find, and the low Zero-crossings are easy to find, and the low amplitude makes it less likely there will be a amplitude makes it less likely there will be a "click" due to a discontinuity."click" due to a discontinuity.

• Even a small discontinuity can cause a Even a small discontinuity can cause a "click" if the amplitude is large."click" if the amplitude is large.

Page 13: SamplingSampling plays back samples of the original tone.plays back samples of the original tone. For simple decaying tones (e.g., piano, harp, marimba,

Picking Loop PointsPicking Loop PointsPicking Loop PointsPicking Loop Points

• Waveform at loop points should have Waveform at loop points should have similar peak amplitudes:similar peak amplitudes:

[iv:77] 2.43-second trumpet tone (ctpt03)

Page 14: SamplingSampling plays back samples of the original tone.plays back samples of the original tone. For simple decaying tones (e.g., piano, harp, marimba,

Picking Loop PointsPicking Loop PointsPicking Loop PointsPicking Loop Points

• Very different peak amplitudes indicate Very different peak amplitudes indicate differences in the amplitudes of some of the differences in the amplitudes of some of the harmonics, which result in an audible harmonics, which result in an audible change in the spectrum if looped.change in the spectrum if looped.

Page 15: SamplingSampling plays back samples of the original tone.plays back samples of the original tone. For simple decaying tones (e.g., piano, harp, marimba,

Picking Loop PointsPicking Loop PointsPicking Loop PointsPicking Loop Points

• Waveform at loop points should have Waveform at loop points should have similar shapes (and phases):similar shapes (and phases):

[iv:77] 2.43-second trumpet tone (ctpt03)

Page 16: SamplingSampling plays back samples of the original tone.plays back samples of the original tone. For simple decaying tones (e.g., piano, harp, marimba,

Picking Loop PointsPicking Loop PointsPicking Loop PointsPicking Loop Points

• A very different waveform shape indicates A very different waveform shape indicates spectral differences, which result in an spectral differences, which result in an audible change in the spectrum if looped.audible change in the spectrum if looped.

• Pick loop points as far apart as possible Pick loop points as far apart as possible where these criteria are still satisfied.where these criteria are still satisfied.

• If the loop points are too close, there will If the loop points are too close, there will not be enough change to make it sound like not be enough change to make it sound like a real tone, and it may sound artificial.a real tone, and it may sound artificial.

Page 17: SamplingSampling plays back samples of the original tone.plays back samples of the original tone. For simple decaying tones (e.g., piano, harp, marimba,

Looping in CsoundLooping in CsoundLooping in CsoundLooping in Csound

• The loscil unit generator reads a mono [or The loscil unit generator reads a mono [or stereo] sound from a table (a soundfile), stereo] sound from a table (a soundfile), with optional sustain and release looping:with optional sustain and release looping:

asig[,asig2] loscil iamp,ifreq,iwt,ibasef,0,0,1asig[,asig2] loscil iamp,ifreq,iwt,ibasef,0,0,1

• loscil arguments:loscil arguments:• xamp — amplitude at i, k or a ratexamp — amplitude at i, k or a rate• kcps — frequency at i or k ratekcps — frequency at i or k rate• iwt — the function number for an .aiff sampled iwt — the function number for an .aiff sampled

sound segmentsound segment

Page 18: SamplingSampling plays back samples of the original tone.plays back samples of the original tone. For simple decaying tones (e.g., piano, harp, marimba,

Looping in CsoundLooping in CsoundLooping in CsoundLooping in Csound

asig[,asig2] loscil iamp,ifreq,iwt,ibasef,0,0,1asig[,asig2] loscil iamp,ifreq,iwt,ibasef,0,0,1

• optional loscil arguments:optional loscil arguments:• [, ibasef] — base frequency of recorded sound [, ibasef] — base frequency of recorded sound

(in cycles per second)(in cycles per second)• [, imode1,ibeg1,iend1][imode2,ibeg2,iend2][, imode1,ibeg1,iend1][imode2,ibeg2,iend2]

• imode1, imode2 — play modes for the sustain and imode1, imode2 — play modes for the sustain and release loops — 0 denotes no loopingrelease loops — 0 denotes no looping

• ibeg1, iend1, ibeg2, iend2 — begin and end points for ibeg1, iend1, ibeg2, iend2 — begin and end points for the sustain and release loops, measured in sample the sustain and release loops, measured in sample frames from the beginning of the fileframes from the beginning of the file

• more details in Csound manualmore details in Csound manual

Page 19: SamplingSampling plays back samples of the original tone.plays back samples of the original tone. For simple decaying tones (e.g., piano, harp, marimba,

Looping in CsoundLooping in CsoundLooping in CsoundLooping in Csound

Csound example of the Csound example of the [iv:78][iv:78] muyu: muyu:

Page 20: SamplingSampling plays back samples of the original tone.plays back samples of the original tone. For simple decaying tones (e.g., piano, harp, marimba,

Looping in CsoundLooping in CsoundLooping in CsoundLooping in Csound

Csound Csound [iv:79][iv:79] sampled bawu: sampled bawu:

(compare with (compare with [iv:80][iv:80] wavetable bawu) wavetable bawu)

[iv:81][iv:81] sampled voice with looping sampled voice with looping

[iv:82][iv:82] same as previous example, with ring same as previous example, with ring modulation effectmodulation effect

Page 21: SamplingSampling plays back samples of the original tone.plays back samples of the original tone. For simple decaying tones (e.g., piano, harp, marimba,

Example 1: Sampling the GuitarExample 1: Sampling the GuitarExample 1: Sampling the GuitarExample 1: Sampling the Guitar• Sound Example: the Eagles, Sound Example: the Eagles, Hotel Hotel

CaliforniaCalifornia [iv:83][iv:83] original performance and original performance and [iv:84][iv:84] using sampling using sampling

Page 22: SamplingSampling plays back samples of the original tone.plays back samples of the original tone. For simple decaying tones (e.g., piano, harp, marimba,

Example 2: Sampling VinaExample 2: Sampling VinaExample 2: Sampling VinaExample 2: Sampling Vina

• [iv:85][iv:85] original pitch original pitch• [iv:86][iv:86] looping Vina looping Vina

sounded badsounded bad• when Vina sings when Vina sings [iv:87][iv:87] catty-ok .... catty-ok ....

• the cat as a percussion instrument, with pitch the cat as a percussion instrument, with pitch bend to straighten out the pitchbend to straighten out the pitch