Hi,

osc.float precisely gives you a value between 0 and 1!

++

Sam.

On Sat, May 4, 2013 at 6:02 PM, Kyriakos Tsoukalas
<[email protected]> wrote:
> Hi again,
>
> Thank you for all this. I am trying to see how far I can go and one last 
> thing is if it could be possible to have a ramp volume change rather than 0-1 
> which is harsh enough.
>
> On Mar 14, 2013, at 11:26 AM, Samuel Mimram wrote:
>
>> Hi,
>>
>> Unfortunately, there is nothing as general as you expect (ie
>> automatically binding functions to sources is not possible). However,
>> with a bit of coding all you are asking is (relatively) easy to
>> program. The idea is to change references when a command occurs. I
>> have coded the solo function as follows, by elaborating on this you
>> can achieve the other commands. Here we go:
>>
>> # We have two sources
>> s1 = playlist("~/Music")
>> s2 = sine()
>>
>> # The volume for each source
>> vol1 = ref 1.
>> vol2 = ref 1.
>>
>> # Amplify sources according to their volume
>> s1 = amplify({!vol1},s1)
>> s2 = amplify({!vol2},s2)
>>
>> # Change the volume when we want to solo / unsolo
>> def solo1 (on) =
>>  if on then
>>    vol1 := 1.
>>    vol2 := 0.
>>  else
>>    vol1 := 1.
>>    vol2 := 1.
>>  end
>> end
>>
>> # Handle commands
>> def on_command1(m) =
>>  cmd = fst(m)
>>  val = snd(m)
>>
>>  if cmd == "solo" and val == "on" then solo1(true) end
>>  if cmd == "solo" and val == "off" then solo1(false) end
>> end
>>
>> # Add handler for commands
>> osc.on_string_pair("/s1/command",on_command1)
>>
>> # Mix the two sources and play them
>> s = add([s1,s2])
>> output.pulseaudio(s)
>>
>> Then I can solo the source s1 using:
>>
>> oscsend localhost 7777 /s1/command ss solo on
>>
>> Unfortunately, you have to program a similar functions command2/solo2
>> to implement the handler for source2, etc.
>>
>> For the sky function, the trick is to add a skyed source with a
>> non-skyed source with amplifications 1./0. or 0./1. depending on
>> whether you want the sky activated. So, you can implement this as
>> follows:
>>
>> # When sky1 is 1. the we have the sky effect and when 0. we don't have it
>> sky1 = ref 1.
>> s1 = add([amplify({!sky1},sky(s1)), amplify({1. - !sky1}, s1)])
>>
>> And then you can add the following lines in command1 in order to
>> implement the handler:
>>
>>  if cmd == "sky" and val == "on" then sky1 := 1. end
>>  if cmd == "sky" and val == "off" then sky1 := 0. end
>>
>> Cheers,
>>
>> Samuel.
>>
>> On Tue, Mar 12, 2013 at 7:36 PM, Kyriakos Tsoukalas
>> <[email protected]> wrote:
>>> Hi Samuel,
>>>
>>> thanks for giving time to this.
>>> On Mar 12, 2013, at 7:24 PM, Samuel Mimram wrote:
>>>
>>>> Hi,
>>>>
>>>> Something along the lines you are mentionning is certainly doable, but
>>>> before answering I would like to undestand better what you want to
>>>> achieve. Could you please give me a more high-level explanation (i.e.
>>>> in english) of the kind of commands you have in mind?
>>> I would like to send osc messages and change one or more sources to new 
>>> ones as "requested" in the osc message.
>>> - If I have 4 different sources from input.harbor and I mix them to a 
>>> "final" one to stream to icecast, I want to send an osc message and change 
>>> one or all sources. If I send "solo on" for source1, I want all other 
>>> sources to silence (amplify 0.), if I send "solo off", I want all sources 
>>> affected before to resume volume. But If I send "sky on" for source1 I want 
>>> source1 to become sky(source1) and if I send "sky off" I want the source1 
>>> to become the old source1. Ohh, and if I send "high on" and then "sky on" 
>>> for source1 I would like the source1 to become sky(high(source1)). So in 
>>> the future someone would be able to create functions of "source processing" 
>>> to apply to sources by sending an osc message. Just this :-}
>>>>
>>>> For instance, it seems that you want to mute the source s1 when you
>>>> receive quiet/on on /s1/rule. Is it necessary to have it muted for 5
>>>> secs or would it be ok to have the source sounding again when it
>>>> recieves quiet/off on /s1/rule? A timeout is much more difficult to
>>>> achieve: without timeout it is just a matter of changing a "volume"
>>>> variable to 0. or 1. (I can help with the code if that's what you
>>>> want). What other kind of commands do you have in mind?
>>>>
>>>> ++
>>>>
>>>> Sam.
>>>>
>>>> On Tue, Mar 12, 2013 at 4:05 PM, Kyriakos Tsoukalas
>>>> <[email protected]> wrote:
>>>>> Hi Samuel,
>>>>>
>>>>> Is it possible to have a source that gets a different processing per 
>>>>> "rule" and "value" when a handler is called, say, by osc.on_string_pair 
>>>>> to provide "rule" and "value". Please point out documentation to read 
>>>>> (request.dynamic? ... concepts I must understand:)
>>>>>
>>>>> Something looking like:
>>>>> # Different processing per OSC "rule" and "value"
>>>>> def rule_handler(rule,value,s)
>>>>> if (rule == "quiet" then
>>>>>  if (value == "on") then
>>>>>    s = blank(duration=5.)
>>>>>  elsif (value == "off")
>>>>>    s = s
>>>>>  end
>>>>> elsif (rule == "sine") then
>>>>>  s = sine(#{value})
>>>>> ...
>>>>> end
>>>>> end
>>>>> def on_rule_s1(m) =
>>>>> rule = fst(m)
>>>>> value = snd(m)
>>>>> # Trigger new source for s1?
>>>>> end
>>>>> s1 = sine()
>>>>> s2 = sine()
>>>>> s1 = rule_handler(?,s1)
>>>>> s1 = rule_handler(?,s2)
>>>>> output = add(normalize=false,[s1,s2])
>>>>>
>>>>> osc.on_string_pair("/s1/rule",on_rule_s1)
>>>>> osc.on_string_pair("/s2/rule",on_rule_s2)
>>>>>
>>>>> output.icecast(%mp3,mount="test.mp3",output)
>>>>>
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Kyriakos
>>>>> On Mar 6, 2013, at 8:57 PM, Samuel Mimram wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> This is quite an interesting application of OSC! It was not really
>>>>>> possible to do so, but I just commited a patch on the git (
>>>>>> 114d1fa908fc9e02547f0de540c11d127d5964cd ) to make it possible. With
>>>>>> this latest git version you can write the following:
>>>>>>
>>>>>> # Replace with music source
>>>>>> s = sine()
>>>>>> s = mksafe(s)
>>>>>>
>>>>>> # Create a function to insert metadata
>>>>>> ms = insert_metadata(s)
>>>>>> # The function to insert metadata
>>>>>> imeta = fst(ms)
>>>>>> # The new source
>>>>>> s = snd(ms)
>>>>>>
>>>>>> # Handler for OSC events (gets pairs of strings)
>>>>>> def on_meta(m) =
>>>>>> # Extract the label
>>>>>> label = fst(m)
>>>>>> # Extract the value
>>>>>> value = snd(m)
>>>>>> # A debug message
>>>>>> print("Insert metadata #{label} = #{value}")
>>>>>> # Insert the metadata
>>>>>> imeta([(label,value)])
>>>>>> end
>>>>>>
>>>>>> # Call the above handler when we have a pair of strings on /metadata
>>>>>> osc.on_string_pair("/metadata",on_meta)
>>>>>>
>>>>>> # Output on icecast
>>>>>> output.icecast(%mp3,mount="test.mp3",s)
>>>>>>
>>>>>>
>>>>>> Then each time I am doing something like:
>>>>>>
>>>>>> oscsend localhost 7777 "/metadata" ss "title" "The new title"
>>>>>>
>>>>>> I get a new metadata :) You should elaborate on this in order to
>>>>>> output all the metadata at once, but it should help to get you
>>>>>> started!
>>>>>>
>>>>>> Cheers,
>>>>>>
>>>>>> Sam.
>>>>>>
>>>>>> On Tue, Mar 5, 2013 at 5:32 PM, Kyriakos Tsoukalas
>>>>>> <[email protected]> wrote:
>>>>>>> Hi all,
>>>>>>> I would like to send OSC messages to a liquidsoap (v1.0.1) server and 
>>>>>>> have it perform specific functions (to a harbor stream) per incoming 
>>>>>>> OSC tags(paths). How would I setup an OSC tag function trigger?
>>>>>>>
>>>>>>> Thanks in advance,
>>>>>>> Kyriakos
>>>>>>> ------------------------------------------------------------------------------
>>>>>>> Everyone hates slow websites. So do we.
>>>>>>> Make your web apps faster with AppDynamics
>>>>>>> Download AppDynamics Lite for free today:
>>>>>>> http://p.sf.net/sfu/appdyn_d2d_feb
>>>>>>> _______________________________________________
>>>>>>> Savonet-users mailing list
>>>>>>> [email protected]
>>>>>>> https://lists.sourceforge.net/lists/listinfo/savonet-users
>>>>>>
>>>>>> ------------------------------------------------------------------------------
>>>>>> Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester
>>>>>> Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the
>>>>>> endpoint security space. For insight on selecting the right partner to
>>>>>> tackle endpoint security challenges, access the full report.
>>>>>> http://p.sf.net/sfu/symantec-dev2dev
>>>>>> _______________________________________________
>>>>>> Savonet-users mailing list
>>>>>> [email protected]
>>>>>> https://lists.sourceforge.net/lists/listinfo/savonet-users
>>>>>>
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester
>>>>> Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the
>>>>> endpoint security space. For insight on selecting the right partner to
>>>>> tackle endpoint security challenges, access the full report.
>>>>> http://p.sf.net/sfu/symantec-dev2dev
>>>>> _______________________________________________
>>>>> Savonet-users mailing list
>>>>> [email protected]
>>>>> https://lists.sourceforge.net/lists/listinfo/savonet-users
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester
>>>> Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the
>>>> endpoint security space. For insight on selecting the right partner to
>>>> tackle endpoint security challenges, access the full report.
>>>> http://p.sf.net/sfu/symantec-dev2dev
>>>> _______________________________________________
>>>> Savonet-users mailing list
>>>> [email protected]
>>>> https://lists.sourceforge.net/lists/listinfo/savonet-users
>>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Everyone hates slow websites. So do we.
>>> Make your web apps faster with AppDynamics
>>> Download AppDynamics Lite for free today:
>>> http://p.sf.net/sfu/appdyn_d2d_mar
>>> _______________________________________________
>>> Savonet-users mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/savonet-users
>>
>> ------------------------------------------------------------------------------
>> Everyone hates slow websites. So do we.
>> Make your web apps faster with AppDynamics
>> Download AppDynamics Lite for free today:
>> http://p.sf.net/sfu/appdyn_d2d_mar
>> _______________________________________________
>> Savonet-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/savonet-users
>>
>
>
> ------------------------------------------------------------------------------
> Get 100% visibility into Java/.NET code with AppDynamics Lite
> It's a free troubleshooting tool designed for production
> Get down to code-level detail for bottlenecks, with <2% overhead.
> Download for free and get started troubleshooting in minutes.
> http://p.sf.net/sfu/appdyn_d2d_ap2
> _______________________________________________
> Savonet-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/savonet-users

------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users

Reply via email to