A new version of Cineversity has been launched. This legacy site and its tutorials will remain accessible for a limited transition period

Visit the New Cineversity
   
 
xpresso Sound node “sample” port useage
Posted: 21 September 2016 11:38 AM   [ Ignore ]  
Total Posts:  108
Joined  2015-11-30

Hello,

I know this node is quite esoteric and pretty much nobody uses it since the output can’t be rendered.
However, I noticed that this node has a port called “sample” and the help file states you have access to each sample in the audio file.
So I tried inputting some constants to see if the magnitude would be output at these specified sample indices and I get nothing..

Its a long shot but I was wondering if anyone has any experience getting audio magnitude data at a sample level?
I’d like to make an accurate audio waveform by iterating samples at the correct project speed relative to iteration size.

Alternatively, is it possible to get any data from the special timeline “Sound” in c4d?
AFAIK the sound effector doesn’t offer sample level audio data.

One alternative I’ve thought of so far is to just use the sound effector and up the project frame rate and use frame skip, not sure if this would affect motion blur though or have other unwanted effects..

Best,
Nick

Profile
 
 
Posted: 21 September 2016 03:09 PM   [ Ignore ]   [ # 1 ]  
Administrator
Avatar
Total Posts:  12043
Joined  2011-03-04

Hi Nick,
Here is a file that hopefully helps you to explore the function

https://www.amazon.com/clouddrive/share/YbFR0ZQEOghYusaC1TnZvkyC9VCc5OgO8OvzbYiJBrg?ref_=cd_ph_share_link_copy

The audio file is a 100Hz sound, 48000KHz and 24 bit stereo, as wav file, -12 db. I bounced it (exported) unfiltered and with no EQ or any dynamic/compressor handling. It is based on a clean sine generator (Logic X>Untilies> EFM 1Fm Synth> Test Oscillator)

I guess 100HZ is what is even on a laptop audible and much easier to see on a screen.

You might have to reconnect the Audio file.
Image:
https://www.amazon.com/clouddrive/share/3kZdxT5lUx9V2htbwencKWpcW6yc49iTfn7cE3P5XHQ?ref_=cd_ph_share_link_copy

That it doesn’t resemble a sine here is certainly based on a way too low “Nyquist” sampling/rate. But explore it.
BTW the “Sample Output” of the Node provides the file sample rate, here 48000KHZ, not anything else.

All the best

 Signature 

Dr. Sassi V. Sassmannshausen Ph.D.
Cinema 4D Mentor since 2004
Maxon Master Trainer, VES, DCS

Photography For C4D Artists: 200 Free Tutorials.
https://www.youtube.com/user/DrSassiLA/playlists

NEW:

NEW: Cineversity [CV4]

Profile
 
 
Posted: 21 September 2016 04:02 PM   [ Ignore ]   [ # 2 ]  
Total Posts:  108
Joined  2015-11-30

Thanks Dr.Sassi,

Am I right in thinking this could be achieved the same way by using sound effector set to deform object affect Y position?
What I would like to do is draw the waveform every frame of animation, which afaik means accessing the sample values for the duration of a frame and iterating through them..

regarding sample, ah so sample input port would just set the sample rate of the sound?

Profile
 
 
Posted: 21 September 2016 04:07 PM   [ Ignore ]   [ # 3 ]  
Administrator
Avatar
Total Posts:  12043
Joined  2011-03-04

Yes, I have showed that back in time, NNenov. :o)

Have a look here:
https://www.cineversity.com/forums/viewthread/783/

You only have to move it in Z or X.

He mentioned the Sound Effector already, so I did not mentioned it again.

The confusion in this thread is based on the idea what a sample is, and the XPresso node should be labeled Sample Rate, not Sample. The Xpresso provides the Sample Rate of an audio file, which is fixed. I have gotten the idea that Sample here is confused with specific value for two dimensions amplitude/time. Which he like to filter over the bands.

Digital sound is recorded based on two main direction, in time in KHz for the sampling rate, which means here 48K times per second. The bid depth is the “vertical amount” and both create crossing points that creates a fixed value. The connection among those points are like the step interpolation of a spline, not a curve, hence why professional audio is at least 48KHz 24bit for Broadcast and most of the time 96KHz for Feature Film, also 24bit. During production those things become converted to much higher bit depth. Eventually repaired even.

All the best

 Signature 

Dr. Sassi V. Sassmannshausen Ph.D.
Cinema 4D Mentor since 2004
Maxon Master Trainer, VES, DCS

Photography For C4D Artists: 200 Free Tutorials.
https://www.youtube.com/user/DrSassiLA/playlists

NEW:

NEW: Cineversity [CV4]

Profile
 
 
Posted: 27 September 2016 11:27 AM   [ Ignore ]   [ # 4 ]  
Total Posts:  108
Joined  2015-11-30

Thanks Dr.Sassi,
That explains everything, so the short answer is that the documentation didn’t phrase it very well, they literally say “This port gives you access to every sample.”

The next thing I’m going to try is just setting the frame rate of the project up very high, then do the sound effector approach to get the “higher sample rate” spline.

Profile
 
 
Posted: 27 September 2016 01:48 PM   [ Ignore ]   [ # 5 ]  
Administrator
Avatar
Total Posts:  12043
Joined  2011-03-04

HI Nick,

Yes, it isn’t phrased well enough. Sample vs Samples. Or I’m too picky (?), perhaps something in between, but the answer is more to keep it short for the interface.

I referred to the “Output Samples” Which, so far I can see, will only provide you with a fixed number of the linked audio file. In other words, if the file was broadcast, it typically will be 48KHz, or CD quality then in 44.1KHz. Those things can vary per file. But the output is determined by the file as data-structure.

The key point here is, that one can’t access a single sample value. Why? Because the Frequency is split up in “Bands”. These “Bands” allow for an averaged value of a group of single sample.

How do I understood your question: Supply the sample number on the input side, and receive a precise value on the outside. Practically, if you have a spline with 48,000 points, and an iteration-node with 0-47,999, the idea would be to set the position in, e.g., X with the iteration and the amplitude with the “single sample”. But based on the limits that the bands create, I have no idea how to do it.

As you correctly mentioned (and I linked even an older thread as conformation), that is visually done in a much nice way with the Sound Effector. Should we go more that route? What can I share or produce to make that workable for you? :o)

I’m really happy to dive into that.

All the best

 Signature 

Dr. Sassi V. Sassmannshausen Ph.D.
Cinema 4D Mentor since 2004
Maxon Master Trainer, VES, DCS

Photography For C4D Artists: 200 Free Tutorials.
https://www.youtube.com/user/DrSassiLA/playlists

NEW:

NEW: Cineversity [CV4]

Profile
 
 
Posted: 27 September 2016 02:39 PM   [ Ignore ]   [ # 6 ]  
Total Posts:  108
Joined  2015-11-30

You make a good point, plotting every sample would be overkill.
I basically just need an amplitude value on a “sub frame” level, which I am now trying with the sound effector and increasing the project frame-rate.

This works and I do get a high quality waveform, but I’m not able to plot it efficiently, since at the moment its just a tracer following a baked mograph clone, it has to be played out, which is very slow (see what I mean: https://dl.dropboxusercontent.com/u/24304389/plot.gif

Since I’ve baked the cloner object, should I not be able to just convert the keyframe x y data to a spline object with respectively plotted points? Maybe that’s a bit strange way to do it.. I could try iterate the key frames and set spline points that way..
What do you think?

Profile
 
 
Posted: 27 September 2016 02:42 PM   [ Ignore ]   [ # 7 ]  
Total Posts:  108
Joined  2015-11-30

I have just realised I’m doing everything wrong.. I don’t actually want the amplitude data, I want the sample values, since they can be 1 to -1, and that gives the true waveform.. I think really I should be doing this with another program, I believe audacity has a print feature which I could use to make vector file and import to c4d.

Profile
 
 
Posted: 27 September 2016 03:01 PM   [ Ignore ]   [ # 8 ]  
Administrator
Avatar
Total Posts:  12043
Joined  2011-03-04

Nick,

Perhaps set the frame rate to, e.g.,  1000[fps] to create the Spline. Then you have at least a few more samples per second.

When the Tracer is done (Animation> Play-Mode> Simple) you can make it editable and set the fps back to 30, 25 or 24, etc.

The Tracer gives you only one sample per frame. The max frame rate in C4D is 2500, so if you need something higher than that, you need to slow down your sound. If the sound speed is 10% you could achieve 25K samples/second.

If you look into Ae for example, the plug in I have used way back in time for this:
http://www.redgiant.com/products/trapcode-sound-keys/

All the best

The 1,000 fps file is here: Sound included, again might be in need to be reconnected.
https://www.amazon.com/clouddrive/share/eEWhmiLRtBDDKlnWZjdolqx9IDVjBS0rM1T01xaXecx?ref_=cd_ph_share_link_copy

 Signature 

Dr. Sassi V. Sassmannshausen Ph.D.
Cinema 4D Mentor since 2004
Maxon Master Trainer, VES, DCS

Photography For C4D Artists: 200 Free Tutorials.
https://www.youtube.com/user/DrSassiLA/playlists

NEW:

NEW: Cineversity [CV4]

Profile
 
 
Posted: 28 September 2016 01:13 AM   [ Ignore ]   [ # 9 ]  
Administrator
Avatar
Total Posts:  12043
Joined  2011-03-04

P.S.:
In the file above the animation is set to spline-interpolation, so the “curve” is deformed. In the file below I have fixed this.

What I noticed here, since it is a 100HZ file, it shows like double. The only explanation that I could find here is that (perhaps) the downswing is kind of as well an upswing. No idea. Perhaps the visual aspect of the curve as drawn here is more important than the precision mathematically. You’re the art director here.

https://www.amazon.com/clouddrive/share/6xjqy2td9oCZvAAwRQsTU0EvKXyFX6WZ7xmZ7G9jfrF?ref_=cd_ph_share_link_copy

 Signature 

Dr. Sassi V. Sassmannshausen Ph.D.
Cinema 4D Mentor since 2004
Maxon Master Trainer, VES, DCS

Photography For C4D Artists: 200 Free Tutorials.
https://www.youtube.com/user/DrSassiLA/playlists

NEW:

NEW: Cineversity [CV4]

Profile