Setting volume control
Re: Setting volume control
Yes, it works great. I copied, pasted and saved it. The only prob is when i click on it, it opens script editor and shows the script. To crossfade, i have to click "run in the editor each time. Can i place a link so all i have to do is click it once like i did with the old one? How do i do that. Thanks for you patience with me
-
- Posts: 1293
- Joined: Sun Apr 20, 2008 9:57 am
- Location: Pittsburgh, PA
- Contact:
Re: Setting volume control
Brendan:
You can just save it as an application in script editor, and then leave it in the dock. You can also just place it in your scripts folder and fire it from the scripts menu (which you can make visible in preferences in Applescript Editor.) Among other options! (like setting it to be run only, in the save dialog.)
You can just save it as an application in script editor, and then leave it in the dock. You can also just place it in your scripts folder and fire it from the scripts menu (which you can make visible in preferences in Applescript Editor.) Among other options! (like setting it to be run only, in the save dialog.)
Last edited by DeusExMachina on Wed Jun 09, 2010 7:48 pm, edited 2 times in total.
-
- Posts: 1293
- Joined: Sun Apr 20, 2008 9:57 am
- Location: Pittsburgh, PA
- Contact:
Re: Setting volume control
Here Dave, I'll do it for you:
Re: Setting volume control
Well that is just f*#kin sweet! Thanks for the help.
-
- Posts: 1293
- Joined: Sun Apr 20, 2008 9:57 am
- Location: Pittsburgh, PA
- Contact:
Re: Setting volume control
Let me know what you think of the other two related scripts I just posted, which, personally, I find far more useful.
Re: Setting volume control
Yes, i tried the one that remembers the last volume. I think i will place both of them in the dock and see which one works best for me. Pretty kewl. How about a script that will auto play itunes when a song in kjams ends?? and vice versa? Is that possible? i dont know but it would be sweetness. Now im getting greedy
Re: Setting volume control
Brendan, I modified the cross fade script to do just what you requested (actually did it a couple of years ago). I recently just posted an update to the script (thanks Dave for adding the kJams Pro play mode variables!).Brendan wrote:How about a script that will auto play itunes when a song in kjams ends?? and vice versa? Is that possible? i dont know but it would be sweetness. Now im getting greedy
You can get the script here :
http://www.runfatboy.net/blog/2010/05/1 ... ading-v20/
Just have kJams Pro, iTunes, and the script running in the Script Editor, and you'll be set.
When kJams begins playing karaoke, iTunes music is automatically faded out. When the karaoke song ends, iTunes will automatically fade back in with a new song from your playlist.
Constant music without any intervention. It's a beautiful thing.
Last edited by aantix on Mon Jun 14, 2010 11:59 pm, edited 1 time in total.
-
- Posts: 1293
- Joined: Sun Apr 20, 2008 9:57 am
- Location: Pittsburgh, PA
- Contact:
Re: Setting volume control
Actually, I was talking about my other two scripts. The one allows you to generate an audio clip of your current singer in the background, and the other, when fired, crossfades between kJams and the most recent audio clip you recorded. You can either let it play out, or you can hit the stop button. Either way, the script then fades the clip out and fades kJams back in, and activates it, so it is back on top. If you want to save the recording, the first script allows you to save the recording to disk for later playback. I don't actually use the iTunes crossfader at all. I routinely have over 35-40 people in my rotation, and I usually get the next singer started within 30 seconds or so, so I have no time to be playing regular filler music.
People DO seem to like the occasional playback, however.
BTW, feel free to wrap aantix' repeat loop and control logic around my script internals, so you can skip setting max levels if you want. I'm REALLY too lazy to do that! : )
People DO seem to like the occasional playback, however.
BTW, feel free to wrap aantix' repeat loop and control logic around my script internals, so you can skip setting max levels if you want. I'm REALLY too lazy to do that! : )
Last edited by DeusExMachina on Sun Jul 04, 2010 1:32 pm, edited 1 time in total.
-
- Posts: 1293
- Joined: Sun Apr 20, 2008 9:57 am
- Location: Pittsburgh, PA
- Contact:
Re: Setting volume control
P.S. Perhaps a better solution than having the scripts in the dock is just to use quicksilver.
Then again, quicksilver is usually a better solution to just about anything!
Then again, quicksilver is usually a better solution to just about anything!
-
- Posts: 1293
- Joined: Sun Apr 20, 2008 9:57 am
- Location: Pittsburgh, PA
- Contact:
Re: Setting volume control
Yeah, Dave, just wait until the karaoke module for quicksilver is finished. Then you'll be in trouble!
Re: Setting volume control
I currently have both scripts (Aantix and Deus)in my dock, I like both. I will have to look into quicksilver, never heard of it. I am not a programmer but to have both scripts rolled into one would be perfect for me. I'm talking about the auto crossfade and the remember last volume crossfade. I'm not a programmer and have no idea how to do it. - Cheers
-
- Posts: 1293
- Joined: Sun Apr 20, 2008 9:57 am
- Location: Pittsburgh, PA
- Contact:
Re: Setting volume control
Oh Brendan, you are about to venture forth into a strange and wondrous world, the world of quicksilver. After you have used it for even a short period of time, you will go to a mac without it, and feel like you do in those dreams where you go to school and find yourself naked!
To launch my record audio script, I just hit ^space and "RA"
To launch my playback script, it is just ^space PA.
But it is sooo much more than an application launcher. It is a copy paste board, a file shelf, and email composer, and many other things. You'll have to find out all for yourself. Just google "quicksilver OSX" and you can do some research.
As to the script you want, again, I almost never use iTunes, because I just don't even have the time to play superfluous audio. Certainly not often enough to want to do it automatically. How do you announce your next singer, if you have to shout it over iTunes?
I will take a look at it, but I am confident that aantix can follow along with my script and can wrap his trigger logic around my control code to give you what you are asking for.
To launch my record audio script, I just hit ^space and "RA"
To launch my playback script, it is just ^space PA.
But it is sooo much more than an application launcher. It is a copy paste board, a file shelf, and email composer, and many other things. You'll have to find out all for yourself. Just google "quicksilver OSX" and you can do some research.
As to the script you want, again, I almost never use iTunes, because I just don't even have the time to play superfluous audio. Certainly not often enough to want to do it automatically. How do you announce your next singer, if you have to shout it over iTunes?
I will take a look at it, but I am confident that aantix can follow along with my script and can wrap his trigger logic around my control code to give you what you are asking for.
Re: Setting volume control
Kewl, im about to do a search on it (quicksilver) and play around with it. I use kjams for me and my family or buddies. I dont dj, i just like itunes kicking in after my friends sing so i dont have silence. We usually talk mess in between singers . Every time a song ends, my buddy says "wheres the music"!!! I also like the idea of recording the singer or part of a singer. Aantix, can you do this? Does it take a long time to write scripts like these? - Cheers
-
- Posts: 1293
- Joined: Sun Apr 20, 2008 9:57 am
- Location: Pittsburgh, PA
- Contact:
Re: Setting volume control
Ok, in order:
1) Quicksilver is a lot more than just for kJams, it is an entirely new interface for OSX. It is system-wide! It does pretty much everything.
2) You should never listen to me!!! I decided to tackle it, even though I don't understand why Aantix is doing half the stuff he is doing. So I made your app. And I eliminated a bunch of code that made no sense to me, and added a bunch of code that makes it do what you want more directly. SOOOO, it cross fades automagically. It does so between whatever initial values you have set. If you decide for whatever reason to change those values, by sliding the volume sliders in either program, the script adjusts and uses the new values to cross fade between. When you first run the script, if kJams is not running, it automatically plays iTunes.
That said, I left in some other control logic that I also do not get. The original script from Aantix skips to the next iTunes track after crossfading. I don't see why you would want to do this, but hey, it is not my script. If you want it not to do this, but rather just to pick up where it left off, just remove the line that says "next track" in the first part of the script.
I will post the final version in the Code wiki once I am sure I have cleaned it up as much as I am able. For now though, I think this does exactly what you wanted it to do and more. (More below.)
P.S. I also removed a lot of the crossfading code, since it made no sense to me why you would crossfade kJams AFTER you had already paused or stopped it! It just seemed like wasted processor cycles, but I guess I could be missing something.
Penultimately ( : ) ), I am not quite sure why you are asking Aantix about recording singers. I am the one who wrote that script. (Are you saying you want him to write one, too, or are you just confused as to who wrote it (not surprising at this point!)
I posted the code in the newly created Code wiki. There are two scripts. One automatically launches QT and uses it to record audio from whatever sound input device you choose. It lets you stop at any point, and gives you the option of saving the file.
The second script automatically crossfades between kJams and the last made clip. If you let the clip play out, it knows where the end is, and cross fades right before it stops. Alternatively, it lets you click on the "Stop Playback" button, which triggers the crossfade back to kJams immediately.
Lastly, I can not speak for Aantix, but it takes me FOREVER to write these things, because I am a freakin' LOUSY coder!
1) Quicksilver is a lot more than just for kJams, it is an entirely new interface for OSX. It is system-wide! It does pretty much everything.
2) You should never listen to me!!! I decided to tackle it, even though I don't understand why Aantix is doing half the stuff he is doing. So I made your app. And I eliminated a bunch of code that made no sense to me, and added a bunch of code that makes it do what you want more directly. SOOOO, it cross fades automagically. It does so between whatever initial values you have set. If you decide for whatever reason to change those values, by sliding the volume sliders in either program, the script adjusts and uses the new values to cross fade between. When you first run the script, if kJams is not running, it automatically plays iTunes.
That said, I left in some other control logic that I also do not get. The original script from Aantix skips to the next iTunes track after crossfading. I don't see why you would want to do this, but hey, it is not my script. If you want it not to do this, but rather just to pick up where it left off, just remove the line that says "next track" in the first part of the script.
I will post the final version in the Code wiki once I am sure I have cleaned it up as much as I am able. For now though, I think this does exactly what you wanted it to do and more. (More below.)
Code: Select all
-- Please have iTunes and kJams running before launching this script and
-- have a playlist selected in iTunes
-- The simple logic of the script assumes that if iTunes is playing and this script is run,
-- you want to cross fade over to kJams.. Alternately, if iTunes is not playing a track,
-- it assumes you want to cross fade over to iTunes.
-- when you are ready to cross fade to kJams, make sure your next song is
-- highlighted/selected. It will NOT automatically go to the next track in
-- your kJams playlist.
-- Unlike the original version of this script, you do not need to set your max volume levels. Instead, it will poll iTunes and kJams for their current volumes, and then cross fade using those values. Even if these volumes are very different, it will fade them such that they reach their appropriate values at the same time. No more need for these values to be identical!
-- Although I have tested this code, I make no guarantees with this code,
-- any disasters that occur are not my fault. Use at your own risk!!
set kSpeakers to 0
--sets how long in seconds between each step in the fade
set fadeDelay to 0.1
set kScriptCommand_PLAY_PAUSE to 1
set kScriptCommand_STOP to 2
--Get current audio volume from kJams
tell application "kJams Pro" to set kJamsMaxVolume to get volume kSpeakers
-- Number of steps in fade
set fadeSteps to 20
--set all volumes to cross fade starting values
--set iTune volume maximum.
tell application "iTunes" to set iTunesMaxVolume to the sound volume
--sets how much in percentage the volume is decreased per step
set kJFadeStep to kJamsMaxVolume / fadeSteps
set iTFadeStep to iTunesMaxVolume / fadeSteps
--this is the minimum volume setting
set MinVolume to 0
-- Playstate will be either 1 for iTunes or 0 for kJams
set playState to 0
set prevPlayState to 0
set kPlayModeType_STOPPED to 0
set kPlayModeType_PLAYING to 1
set kPlayModeType_PAUSED to 2
repeat
tell application "kJams Pro"
set playMode to get mode
end tell
tell application "iTunes"
if (playMode = kPlayModeType_PLAYING) then
set playState to 0
-- If prevPlayState is not the same as the current state
if (prevPlayState = 1) then
set kJamsVolume to MinVolume
tell application "kJams Pro" to set volume kSpeakers level MinVolume
repeat until (iTunesVolume ≤ 0 and kJamsVolume ≥ kJamsMaxVolume)
set iTunesVolume to (iTunesVolume - iTFadeStep)
set kJamsVolume to (kJamsVolume + kJFadeStep)
set the sound volume to iTunesVolume
tell application "kJams Pro" to set volume kSpeakers level kJamsVolume
delay fadeDelay
end repeat
next track
pause
end if
-- I repeat these lines in case you decide to change the volume levels while you are working. Otherwise, they will always reset to the original values.
--Get current audio volume from kJams
--tell application "kJams Pro" to set kJamsMaxVolume to get volume kSpeakers
--set kJFadeStep to kJamsMaxVolume / fadeSteps
else
set playState to 1
if (prevPlayState = 0) then
-- I repeat these lines in case you decide to change the volume levels while you are working. Otherwise, they will always reset to the original values.
--Get current audio volume from kJams
tell application "kJams Pro" to set kJamsMaxVolume to get volume kSpeakers
set kJFadeStep to kJamsMaxVolume / fadeSteps
tell application "kJams Pro" to set volume kSpeakers level MinVolume
--set all volumes to cross fade starting values
set iTunesVolume to MinVolume
set the sound volume to MinVolume
play
repeat until iTunesVolume ≥ iTunesMaxVolume
set iTunesVolume to (iTunesVolume + iTFadeStep)
set the sound volume to iTunesVolume
--tell application "kJams Pro" to set volume kSpeakers level MinVolume
delay fadeDelay
end repeat
end if
-- I repeat these lines in case you decide to change the volume levels while you are working. Otherwise, they will always reset to the original values.
--Get current audio volume from iTunes
set iTunesMaxVolume to the sound volume
set iTFadeStep to iTunesMaxVolume / fadeSteps
end if
set prevPlayState to playState
delay 0.5
end tell
end repeat
Penultimately ( : ) ), I am not quite sure why you are asking Aantix about recording singers. I am the one who wrote that script. (Are you saying you want him to write one, too, or are you just confused as to who wrote it (not surprising at this point!)
I posted the code in the newly created Code wiki. There are two scripts. One automatically launches QT and uses it to record audio from whatever sound input device you choose. It lets you stop at any point, and gives you the option of saving the file.
The second script automatically crossfades between kJams and the last made clip. If you let the clip play out, it knows where the end is, and cross fades right before it stops. Alternatively, it lets you click on the "Stop Playback" button, which triggers the crossfade back to kJams immediately.
Lastly, I can not speak for Aantix, but it takes me FOREVER to write these things, because I am a freakin' LOUSY coder!
Last edited by DeusExMachina on Wed Jun 16, 2010 12:28 am, edited 1 time in total.
Re: Setting volume control
I work as a software engineer for my day job, so it didn't take too long to make the modification (especially considering the original crossfade script got me 90% there).DeusExMachina wrote:Lastly, I can not speak for Aantix, but it takes me FOREVER to write these things, because I am a freakin' LOUSY coder!
At the rate you're coding, maybe you should start to consider a new gig. Thanks for sharing your scripts and making those modifications.