| Author |
Message |
Stochastic

Joined: Feb 25, 2008 Posts: 45 Location: Vancouver
|
Posted: Wed Dec 03, 2008 3:48 pm Post subject:
issues with my homework |
 |
|
Hey, so as the title suggests, this problem concerns my homework - but alas, don't worry I'm not looking for the forum to finish it or anything like that. I've just merely run into a little anomaly and am looking for an explanation. I'll probably end up handing this assignment in as it is, and having the examples well constructed to hide this anomaly, but I'd still like to understand and possibly fix it. I've attached my fm instrument file below (I know, it's not the prettiest file out there).
What I'm curious about is the fact that as the test code plays the instrument the notes eventually degrade in quality. This phenomenon is most striking once the test code reaches the same range it started in.
One of the only explanations I can come up with is that when I'm unchucking a modulator, I'm not doing it at a zero crossing and thus it doesn't return to it's proper - unmodulated - pitch. I tried adding the (1-s.phase())*s.period() => now; zero crossing hack that Kassen posted to the mailing list earlier this year, but it simply takes too long with all those connections.
On the other hand, on each note is re-initialized to a new .freq and .gain on each play() instance, so unless the sync mode of 2 is what's keeping the modulation in memory, then I'm not sure that this is where the problem lies.
Can anyone suggest where to go from here to fix this?
| Description: |
|
 Download (listen) |
| Filename: |
fm.ck |
| Filesize: |
7.34 KB |
| Downloaded: |
281 Time(s) |
_________________ http://greyrock.blogspot.com |
|
|
Back to top
|
|
 |
Kassen
Janitor


Joined: Jul 06, 2004 Posts: 7678 Location: The Hague, NL
G2 patch files: 3
|
Posted: Wed Dec 03, 2008 4:22 pm Post subject:
|
 |
|
Sorry, no time to look at your code now, I need some sleep, but a quick idea;
You say you suspect the issue is with the phase of the osc's not being at 0 when you re-use them, right? So, why not set the phase to 0 when you initialise the .freq() and .gain()? If a reset phase is what you want then that should be what you should do, I'd think?
I have no idea why phase in FM should lead to "degraded quality" so I'd think there might be another issue (of course it might!). I'll have a look in the morning (my time) as this sounds interesting. _________________ Kassen |
|
|
Back to top
|
|
 |
Stochastic

Joined: Feb 25, 2008 Posts: 45 Location: Vancouver
|
Posted: Wed Dec 03, 2008 5:00 pm Post subject:
|
 |
|
to clarify my hypothesis,
It's as I'm unchucking a modulator from a carrier that the phase of the modulator is not at 0. I suspect this leaves the carrier at a permanently adjusted rate. Resetting the phase to 0 would not unmodulate the carrier.
But as I ponder this some more, I wonder if that's the case, wouldn't the effects become much more audible much quicker - particularly with the number of modulators I'm chucking/unchucking.
Also, it's totally possible that I'm way off the mark on my hypothesis and the anomaly lies elsewhere in my code.
Edit: Setting the modulator's phase to 0 right before unchucking it, does seem to help slightly, but does not fully fix the problem. _________________ http://greyrock.blogspot.com |
|
|
Back to top
|
|
 |
Kassen
Janitor


Joined: Jul 06, 2004 Posts: 7678 Location: The Hague, NL
G2 patch files: 3
|
Posted: Thu Dec 04, 2008 8:52 am Post subject:
|
 |
|
Sorry, today has been busy and I'm about to leave for a dinner appointment.
I just read over your code and couldn't find any really obvious issues. A degradation in sound quality without obvious givaways like increased CPU cost could be a subtle issue.
Some notes, this is subjective stuff, maybe you prefer your own style;
Here and there I feel readability could be improved by using the "+=>" and "-=>" operators. If you didn't already I'd suggest looking into those and evaluating how useful you feel those may be to you in a few spots in this code.
You can chuck durations to now, you can chuck events to now but you can also chuck objects of type "time" to now, assuming they refer to a time in the future, and the result will be execution pausing for that shred until this moment arrives. Your code (in the final paragraphs) demonstrates compensating for variable durations quite literally and that may be a choice you made to clarify what you were doing and why but it does lead to some statements that look more complicated then they need to be to me.
Not of much practical use, maybe, but those were the only bits that stood out to me and they may be helpful. It looks like the real issue will need a more detailed analysis for which I don't have the time right now. _________________ Kassen |
|
|
Back to top
|
|
 |
rogan

Joined: Dec 16, 2007 Posts: 83 Location: Urbana, IL
Audio files: 5
|
Posted: Sat Dec 06, 2008 1:51 am Post subject:
|
 |
|
| I played through, and I'm not exactly sure that I see your problem. Maybe I just don't know what to listen for. Did you ever figure this out? |
|
|
Back to top
|
|
 |
Stochastic

Joined: Feb 25, 2008 Posts: 45 Location: Vancouver
|
Posted: Sat Dec 06, 2008 8:52 pm Post subject:
|
 |
|
If you listen to the first and last notes of the file, they should sound nearly identical, but the last few sound quite 'fm distorted' as if I have my C:M ratios off. That point is the most notable, but the same issue pervades the whole file.
Is it just me that hears this? Is this stemming from my system rather than the code? _________________ http://greyrock.blogspot.com |
|
|
Back to top
|
|
 |
|