Kyma Forum
  Tips & Techniques
  batched spectrum files?

Post New Topic  Post A Reply
profile | register | preferences | faq | search

next newest topic | next oldest topic
Author Topic:   batched spectrum files?
ukuphambana
Member
posted 21 June 2002 19:15         Edit/Delete Message   Reply w/Quote
Anyone know or can think up a way to batch-create spectrum files? I've played with the script-controlled disk-recorder example and had some pretty good results. Now I'd like to try something similar with spectral analysis and find I'm stuck.

Basically, I'd like to have a shortcut for converting a whole bunch, maybe a directory full, of small audio files into spectral equivalents. I don't need incredibly specific settings for the spectral analysis (this isn't for precise morphing or something), just some ideas for automation.

Of course I could always do the grunt-work by hand, but that's what we have computers for isn't it!

Well...any input would be welcome. Thanks.


IP: Logged

SSC
Administrator
posted 23 June 2002 13:49         Edit/Delete Message   Reply w/Quote

spectAnMsg.txt

 
Here's a text file with the Smalltalk message for creating an analysis file. (To run the program, open it in Kyma, select all and do a ctrl-y for Evaluate). You could use this as a starting point for making a batch analysis program (by removing the file dialog and giving the filenames directly from an array and doing the analysis in a loop). Maybe you could post the result here? (as I'm sure there are lots of Kyma-ites interested in doing batch analyses).

IP: Logged

ukuphambana
Member
posted 27 June 2002 12:10         Edit/Delete Message   Reply w/Quote
Great! That's exactly what I need. I'll play around with scripting this as soon as I get a chance and let folks know how it goes.

In case you're interested, I was partly inspired to do this by an IRCAM program I read about called Diphone Studio. From the description of it on their web site, it apparently does some automated chopping up of source files into a list of analyses and then lets you iteratively morph through the list, allowing you to tweak various morph parameters throughout. This technique seems oriented towards speech synthesis, but I can think of lots of other fun things to do with it as well. So, long story short, I decided to try something similar in Kyma. I can't think of any reason it shouldn't be possible.


IP: Logged

dgkiers
Member
posted 27 June 2002 13:40         Edit/Delete Message   Reply w/Quote
Very nice, or maybe even cool? For me the next step would be batched spectrum resynthesis. I remember that some script was passed around the Forum some time ago enabling selection from a list of spectrum files. Does anybody still have this on her/his disk?
Thanks, David.

IP: Logged

ukuphambana
Member
posted 27 June 2002 14:43         Edit/Delete Message   Reply w/Quote
I was thinking more along the lines of morphing iteratively through the list of analyses...so rather than just morphing between one sound and another you start with sound1, then morph from sound_1 to sound_2, then from sound_2 to sound_3, and so on to sound_n. I think it'll be tricky to figure out a general way of doing this but I'm gonna work on it, maybe start with some specific examples and work my way up to a generic script which would automate everything.

In any case, I definitely think batch analysis is a handy thing to have!

Have you tried doing a search thru the Forum archives for that example file? I definitely remember some example or other about using array logic in parameter fields, but I don't recall whether it had anything to do with spectrum files.

Er...just realized that what I'm describing above might well be described as "batch resynthesis"! I guess it didn't click initially if that's what you were thinking.

[This message has been edited by ukuphambana (edited 27 June 2002).]

IP: Logged

dgkiers
Member
posted 27 June 2002 15:01         Edit/Delete Message   Reply w/Quote
I think we are on the same line. Being able to use multiple spectrum files without having to use multiple resynthesis Sounds.
Option?: create one long spectrum file and use indices to acces the individual spectra....I guess this calls for a manipulated spectral analysis program


IP: Logged

SSC
Administrator
posted 27 June 2002 17:14         Edit/Delete Message   Reply w/Quote
Or you could chain the original samples together (by pasting one after the other in the Samples Editor) and then analyze the chained samples using the SpectralAnalysis tool.

IP: Logged

dgkiers
Member
posted 28 June 2002 06:57         Edit/Delete Message   Reply w/Quote

memory.kym

 
I am trying to do spectrum resynthesis with a spectrum written to the memory after live analysis as described by SSC on this forum:

>Alternatively, you could use a MemoryWriter for the left (amplitudes) and another MemoryWriter to capture the right (the frequencies). Then a ChannelJoin on samples playing back the left and the right halves of the analysis. One final kludge step is required. You have to mix the ChannelJoin with a SpectrumFromArray that has the same "spectrum period" as the analysis. (For example, if you analyzed at 1F, the period of the spectrum is 512, if you analyzed at 2F it is 256, etc). The OscillatorBank asks the SpectrumSource for the spectrum period, so by mixing in the (silent) SpectrumFromArray, you can trick the OscillatorBank into reading your recorded analysis as if it were a live analysis or an analysis stored to disk using the Tool.

I tried several versions but did not succeed (see attached Sound). Did anybody get this to work properly or does anybody see the mistake I made in the attached file?


quote:
Originally posted by SSC:
Or you could chain the original samples together (by pasting one after the other in the Samples Editor) and then analyze the chained samples using the SpectralAnalysis tool.


IP: Logged

Bill Meadows
Member
posted 30 June 2002 11:55         Edit/Delete Message   Reply w/Quote
quote:
Originally posted by dgkiers:
I am trying to do spectrum resynthesis with a spectrum written to the memory after live analysis as described by SSC on this forum:

I was interested in this also. (I think the SSC reply you quoted was to me.) Anyway, I was never succesful. I'll take a look at your sound and try my hand at it again. I wanted to be able to do variable playback speed and direction with a "live" sound just I could with pre-analyzed ones. Is that what you're after? If you just want delay, it's easier in the time-domain.


IP: Logged

dgkiers
Member
posted 30 June 2002 14:55         Edit/Delete Message   Reply w/Quote
Exactly my goal.



IP: Logged

SSC
Administrator
posted 30 June 2002 16:24         Edit/Delete Message   Reply w/Quote

Liveanalysistomemory.kym

 
Here is an alternate version of your Sound. To fix it, I checked "Cyclic" in the MemoryWriter so that it was continuously writing into the wavetable memory, not just for the first two seconds. I also had to uncheck Log in the Spectrum as the OscillatorBank is expecting a linear spectrum from the LiveAnalysis. (The only log spectra come from the analyses saved on disk).

I threw in another alternative using SyntheticSpectrumFromSounds. And I tried some mutators examples that shift the amplitudes relative to the frequencies and that loops through different frequencies (both of which get pretty whack after a while since they are no longer maintaining the spectrum period of 128 samples).

(Not sure whether you will be able to do the time manipulations that you want to do, though, since it has a realtime input)

IP: Logged

SSC
Administrator
posted 30 June 2002 17:45         Edit/Delete Message   Reply w/Quote

loopspectrum.kym

 
Upon further reflection, I think I understand that you would like to capture the spectrum of a live input, and *then* manipulate it. So here are some examples that let you capture the live input using a switch and then let you play back the spectrum more slowly, faster, and backwards. There's also an example of using HotPinkNoise as the time index to jump to random frames of the spectrum. Fun!

IP: Logged

dgkiers
Member
posted 01 July 2002 09:07         Edit/Delete Message   Reply w/Quote
Could you please explain the /2 (and the noise when I leave it out) in the waveshaper index calculations.
And is there a trick to make the signal, the mix of the ChannelJoin and the SyntheticSpectrum, digestable for the Spectral Modifier Sounds?
Thanks very mutch, David.

[This message has been edited by dgkiers (edited 01 July 2002).]

IP: Logged

franz
Member
posted 17 February 2013 07:04         Edit/Delete Message   Reply w/Quote
As I now tried for hours to figure out how to alter this program so that it analyzes a whole set of samples (rather than one after another) - is anybody willing to give it a try?
The the batch analysis tool in the Kyma menue does only a spectrum analysis of tau files. (Sometimes the spectrum analyzer gives better results than the tau.)
Best,
Franz

P.S. I tried to merge these two programs:

1)
KymaSOSFileEditorView
analyzeNonharmonicSpectrumOfSample:
(SamplesFile
canonicalNameFor:
(HostDriverInterface
getFileWithPrompt: 'Select the samples file to be analyzed:'
fileTypes: (Array with: HostDriverInterface aiffFileType)
ifCancel: [^ self])
ifAbsent: [^ self])
lowestAnalyzedFreq: #'above 1F (44 hz)'
response: #bestTime
forLooping: false.


2)
| fileInSourceFolder files t fileInDestinationFolder |

fileInSourceFolder := SamplesFile
fromOldFilename: (HostDriverInterface
getFileWithPrompt: 'Select a sample within the folder of samples you wish to process.'
fileTypes: HostDriverInterface sampleFileTypes
ifCancel: [^ self]).

fileInDestinationFolder := SamplesFile
fromOldFilename: (HostDriverInterface
getFileWithPrompt: 'Select a sample within the folder where you would like to SAVE the processed samples.'
fileTypes: HostDriverInterface sampleFileTypes
ifCancel: [^ self]).

files := (fileInSourceFolder fileName sampleFileNamesInSameFolder) collect: [:name | SamplesFile fromOldFileNamed: name].

t := 0.
files do: [:f |
| dur |
dur := f sampleFrames samp s.
playAndRecord start: t s
filename: f fileName
recname: (fileInDestinationFolder filename head, 'P', f filename tail)
dur: dur
rate: rate.
t := t + dur]


[This message has been edited by franz (edited 04 March 2013).]

[This message has been edited by franz (edited 04 March 2013).]

IP: Logged

SSC
Administrator
posted 18 February 2013 19:57         Edit/Delete Message   Reply w/Quote
Franz, would like the resulting spectra to be nonharmonic spectra or harmonic?

IP: Logged

SSC
Administrator
posted 18 February 2013 20:00         Edit/Delete Message   Reply w/Quote
quote:
morph from sound_1 to sound_2, then from sound_2 to sound_3, and so on to sound_n.

btw, nowadays, one could use the Morph1dSpectrum->OscillatorBank (or other bank) to do this kind of linear morph from one spectrum to the next.

IP: Logged

franz
Member
posted 21 February 2013 07:34         Edit/Delete Message   Reply w/Quote
quote:
Originally posted by SSC:
Franz, would like the resulting spectra to be nonharmonic spectra or harmonic?

Hi SSC, right now I need nonharmonic spectra but it would be great to have the choice (I would not mind alter the programm myself if you tell me what I have to do).
best,
Franz

P.S.
how would I change the part which says whether the sample should be a wave or aiff file?

fileTypes: (Array with: HostDriverInterface aiffFileType)

[This message has been edited by franz (edited 21 February 2013).]

IP: Logged

franz
Member
posted 04 March 2013 06:05         Edit/Delete Message   Reply w/Quote
quote:
Originally posted by franz:
As I now tried for hours to figure out how to alter this program so that it analyzes a whole set of samples (rather than one after another) - is anybody willing to give it a try?
The the batch analysis tool in the Kyma menue does only a spectrum analysis of tau files. (Sometimes the spectrum analyzer gives better results than the tau.)
Best,
Franz

P.S. I tried to merge these two programs:

1)
KymaSOSFileEditorView
analyzeNonharmonicSpectrumOfSample:
(SamplesFile
canonicalNameFor:
(HostDriverInterface
getFileWithPrompt: 'Select the samples file to be analyzed:'
fileTypes: (Array with: HostDriverInterface aiffFileType)
ifCancel: [^ self])
ifAbsent: [^ self])
lowestAnalyzedFreq: #'above 1F (44 hz)'
response: #bestTime
forLooping: false.


2)
| fileInSourceFolder files t fileInDestinationFolder |

fileInSourceFolder := SamplesFile
fromOldFilename: (HostDriverInterface
getFileWithPrompt: 'Select a sample within the folder of samples you wish to process.'
fileTypes: HostDriverInterface sampleFileTypes
ifCancel: [^ self]).

fileInDestinationFolder := SamplesFile
fromOldFilename: (HostDriverInterface
getFileWithPrompt: 'Select a sample within the folder where you would like to SAVE the processed samples.'
fileTypes: HostDriverInterface sampleFileTypes
ifCancel: [^ self]).

files := (fileInSourceFolder fileName sampleFileNamesInSameFolder) collect: [:name | SamplesFile fromOldFileNamed: name].

t := 0.
files do: [:f |
| dur |
dur := f sampleFrames samp s.
playAndRecord start: t s
filename: f fileName
recname: (fileInDestinationFolder filename head, 'P', f filename tail)
dur: dur
rate: rate.
t := t + dur]


I would be thankful for any help. Any suggestions how I can combine both programs? Right now IŽd need a nonharmonic batch analysis.
best,
Franz

IP: Logged

ChristianSchloesser
Member
posted 04 March 2013 07:13         Edit/Delete Message   Reply w/Quote
quote:
Originally posted by franz:
Right now IŽd need a nonharmonic batch analysis.

I 2nd that!
Also doing the tuning "the other way arround" ...means pitch the sample to a fixed reference pitch to derive the tuning from that would be nice...
Much easier on noisy signals to use then tuning an oscillator to the sample...

cheers
Chris
p.s.: i will investigate in this but i could not make any promises because i fight with another Kyma "Tool" at this moment ;-)

IP: Logged

gustl
Member
posted 11 February 2015 04:11         Edit/Delete Message   Reply w/Quote
quote:
how would I change the part which says whether the sample should be a wave or aiff file?
fileTypes: (Array with: HostDriverInterface aiffFileType)

Use sampleFileType instead of aiffFileType.

Anyone did a batch nonharmonic analysis yet? My smalltalk is too small to merge the programs...

IP: Logged

All times are CT (US)

next newest topic | next oldest topic

Administrative Options: Close Topic | Archive/Move | Delete Topic
Post New Topic  Post A Reply

Contact Us | Symbolic Sound Home

This forum is provided solely for the support and edification of the customers of Symbolic Sound Corporation.


Ultimate Bulletin Board 5.45c