![]() |
![]() ![]() ![]() ![]() ![]()
|
next newest topic | next oldest topic |
Author | Topic: Stuck on some code! |
JackRosete Member |
![]() ![]() ![]() I'm using some Sample Sounds to play drum hits triggered by Analog Sequencers. I would now like to add some looping functions based on a global !BPM fader. Basically, I would like LoopStart to be 0, and LoopEnd to be Loopstart (0) + the duration of divisions of one beat (as specified by !BPM). I'll need a VCS fader that allows the user to chose the division (in real-time) from say the following: 1 beat, 1/2 beat, 1/4 beat, 1/8 beat, 1/16 beat, 1/32 beat, 1/64 beat and 1/128 beat. The selected division will specify the loop length. As I move the global !BPM fader, I want those loop lengths to change accordingly, so that they always conform to divisions of one beat following the !BPM of the sequencer. I've started sketching out some codes but I'm not sure what the best way to approach this problem is, any help would be much appreciated! Thanks! Jack IP: Logged |
SSC Administrator |
![]() ![]() ![]() Since loop end is a proportional value (from 0 to 1), the duration has to be divided by the duration of the sample. For example if your sample were named 'myLoop', you could use: !StartLoop + (!Dur s / 'myLoop' sampleFileDuration) Alternatively, you could always work with subdivisions of the entire sample duration (irrespective of absolute durations in sections), for example !StartLoop + !SubDiv inverse And you could restrict the values of !SubDiv in the VCS to be integers. In the Frequency field, you could multiply default by the ratio of the desired BPM to the natural BPM of the sample, for instance default * (!BPM / ('myLoop' sampleFileDuration bpm removeUnits * !BeatsPerBar) IP: Logged |
JackRosete Member |
![]() ![]() ![]() I'm not sure I understood your second suggestion: 'Alternatively, you could always work with subdivisions of the entire sample duration (irrespective of absolute durations in sections), for example !StartLoop + !SubDiv inverse And you could restrict the values of !SubDiv in the VCS to be integers. In the Frequency field, you could multiply default by the ratio of the desired BPM to the natural BPM of the sample, for instance default * (!BPM / ('myLoop' sampleFileDuration bpm removeUnits * !BeatsPerBar)' Wouldn't this change the default frequency of the sample? -------------------------------------------------------------------------- But I tried something using your first suggestion: !LoopStart + (LoopDuration L s / 'fx_bleep_noise.wav' sampleFileDuration) LoopDuration is a constant with the following code (specifying the desired loop duration in seconds): !BPM bpm s removeUnits / (!BeatDivision into: #({1@1} {2@1/2} {3@ 1/4} {4@1/8} {5@1/16} {6@1/32} {7@1/64} {8@1/128})) !BPM is my global bpm fader, !BeatDivision is a new VCS fader (range: 1 - 8, grid size: 1). I thought with the warped fader expression I could set integers 1 - 8 to the desired beat divisions I mentioned before 1/1, 1/2, 1/4, etc... For some reason or other this isn't working! [This message has been edited by JackRosete (edited 04 July 2006).] IP: Logged |
JackRosete Member |
![]() ![]() ![]() I've managed to get it working. Was a case of cleaning up the code a little, but also correcting a mistake I'd made using / instead of *. I've used this in the LoopEnd field: !LoopStart + (LoopDuration L s / 'hh09.wav' sampleFileDuration) ...and this in the LoopDuration constant: ((!BPM bpm s removeUnits) * (!BeatDivision into: #({1@(1/8)} {2@(1/16)} {3@(1/32)} {4@(1/64)} {5@(1/112)} {6@(1/256)} {7@(1/512)} {8@(1/1024)}))) [This message has been edited by JackRosete (edited 04 July 2006).] IP: Logged |
All times are CT (US) | next newest topic | next oldest topic |
![]() ![]() |
This forum is provided solely for the support and edification of the customers of Symbolic Sound Corporation.