26 May '13 - 05:40 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
  Home Help Search Login Register  
  Show Posts
Pages: [1]
1  Developments / BASS / Re: Latency on BASS_Mixer_StreamAddChannel on: 16 Mar '13 - 10:23
Hello Ian,

In fact, you were right, there were two threads processing at the same time. It's work great now.

Many thanks
ReplyReply Reply with quoteQuote
2  Developments / BASS / Re: Latency on BASS_Mixer_StreamAddChannel on: 11 Mar '13 - 16:10
Thank you Ian.

I changed my code to use BASS_Mixer_ChannelSetEnvelope. Can you confirm to me that I can use a floating point number with BASS_ChannelSeconds2Bytes ? Because I need to use milliseconds to fade in/out.

About my latency problem, your comment makes me think a problem with the IceCast encoding function. So I would like to use code below but there is "glitch" and some problem with buffer I think. As if I had a bad Internet connection with a poor speed. So, I thought to use BASS_ChannelGetData but I don't know if it's correct especially about buffer and lenght.

ENCODER
Dim encoder = BassEnc.BASS_Encode_Start(StreamMixed(0), "lame -r -s 44100 -b 128 -",  BASSEncode.BASS_ENCODE_NOHEAD, Nothing, 0)
BassEnc.BASS_Encode_CastInit(encoder, "127.0.0.1:8000/stream", "password", BassEnc.BASS_ENCODE_TYPE_MP3, "name", "", "", Nothing, Nothing, 128, True)

CHANNELGETDATA
Do While BassEnc.BASS_Encode_IsActive(encoder) <> BASSActive.BASS_ACTIVE_STOPPED
            Dim length As Integer = CInt(Bass.BASS_ChannelSeconds2Bytes(StreamMixed(DepartureNbr), 0.01))
            Dim data(length) As Byte
            Bass.BASS_ChannelGetData(StreamMixed(0), data, length)
Loop
ReplyReply Reply with quoteQuote
3  Developments / BASS / [SOLVED] Latency on BASS_Mixer_StreamAddChannel on: 4 Mar '13 - 17:35
Hello,

Here is what my software doing :
1) It decodes a stream IceCast
2) Split the IceCast's stream X times
3) Detects a frequency and mix a sound file
4) Encode the result to another mount point IceCast

The application does not play sound on a sound card, everything is done by decoding.

My problem is when it detects the frequency, the fadeout is good but the sound file is started with a random time ! This can be instantaneous or take several seconds. Is it a problem with Bass.Net and buffer or something like that. Or with multi-threading ?

Thank you very much for your help.

Here is a sample of my code :

' INITIALIZING
' Create stream mixer in a thread

StreamMixed(i) = BassMix.BASS_Mixer_StreamCreate(44100, 2, BASSFlag.BASS_STREAM_DECODE)
' Create stream for each file to play in another thread
StreamFile(i, j) = Bass.BASS_StreamCreateFile(File, 0, 0, BASSFlag.BASS_STREAM_DECODE)
' Create stream for "IceCast in" in another thread
Dim StreamDecodedSource = Bass.BASS_StreamCreateURL(Source, 0, BASSFlag.BASS_STREAM_DECODE, Nothing, IntPtr.Zero)
' Split "IceCast in" stream for each stream mixer in another thread
StreamDecoded(i) = BassMix.BASS_Split_StreamCreate(StreamDecodedSource, BASSFlag.BASS_STREAM_DECODE, Nothing)
' Adding stream "IceCast in" to each stream mixer in the same thread of above
BassMix.BASS_Mixer_StreamAddChannel(StreamMixed(i), StreamDecoded(i), BASSFlag.BASS_STREAM_AUTOFREE Or BASSFlag.BASS_MIXER_DOWNMIX)

' CRUISING
'Streaming to IceCast out in a new thread

Dim Lame As New EncoderLAME(StreamMixed(DepartureNbr))
            Lame.InputFile = Nothing
            Lame.OutputFile = Nothing
            Lame.LAME_Bitrate = CInt(EncoderLAME.BITRATE.kbps_128)
            Lame.LAME_Mode = EncoderLAME.LAMEMode.Default
            Lame.LAME_TargetSampleRate = Int(EncoderLAME.SAMPLERATE.Hz_44100)
            Lame.LAME_Quality = EncoderLAME.LAMEQuality.Quality
            Lame.Start(Nothing, IntPtr.Zero, False)
            Dim IceCast As New ICEcast(Lame)
            IceCast.ServerAddress = ServersToStream(i, 1)
            IceCast.ServerPort = ServersToStream(i, 2)
            IceCast.Username = ServersToStream(i, 3)
            IceCast.Password = ServersToStream(i, 4)
            IceCast.MountPoint = ServersToStream(i, 5)
            IceCast.StreamName = ServersToStream(i, 0)
            IceCast.StreamGenre = ""
            IceCast.PublicFlag = False
            IceCast.SongTitle = ""
            If IceCast.Connect() Then
                If IceCast.Login() Then
                    If IceCast.IsConnected() Then
                        Dim m_BroadCast As New BroadCast(IceCast)
                        m_BroadCast.AutoReconnect = True
                        m_BroadCast.ReconnectTimeout = 5
                        Dim length As Integer = CInt(Bass.BASS_ChannelSeconds2Bytes(StreamMixed(i), 0.03))
                        Dim data(length) As Byte
                        Dim length2 As Integer
                        Do While IceCast.IsConnected()
                            length2 = Bass.BASS_ChannelGetData(StreamMixed(i), data, length)
                        Loop
                    End If
                End If
            End If
' Checking for frequency in stream "IceCast in" in another thread
Dim P As Visuals = New Visuals()
Dim Freq = P.DetectFrequency(StreamMixed(i), 16495, 16505, False)
If Freq >= CDbl("1") Then
                            Dim PlayWayBThread As New Thread(AddressOf PlayWayB)
                            PlayWayBThread.IsBackground = True
                            PlayWayBThread.Start(i)
End If
' PlayWayB adding file to a stream mixer, and mute/unmute "IceCast in" in new thread
Dim AudioFadeOutThread As New Thread(AddressOf AudioFadeOut) ' Fade out source
                AudioFadeOutThread.IsBackground = True
                AudioFadeOutThread.Start(DepartureNbr)
                AudioFadeOut(DepartureNbr)
Dim StreamWayB = BassMix.BASS_Mixer_StreamAddChannel(StreamMixed(i), StreamFile(i, SelectedFile), BASSFlag.BASS_STREAM_AUTOFREE) ' Play sound file
Thread.Sleep(CInt(Playlist(DepartureNbr, SelectedFile(DepartureNbr) - 1, 0))) ' Waiting to end of file

Dim AudioFadeInThread As New Thread(AddressOf AudioFadeIn) ' Fade in source
                AudioFadeInThread.IsBackground = True
                AudioFadeInThread.Start(i)


' Here is sub of fade out and in
AudioFadeOut()
Bass.BASS_ChannelSlideAttribute(StreamDecoded(i), BASSAttribute.BASS_ATTRIB_VOL, 0, ChannelAFadeOutTime)

AudiFadeIn()
Bass.BASS_ChannelSlideAttribute(StreamDecoded(i), BASSAttribute.BASS_ATTRIB_VOL, 1, ChannelAFadeOutTime)
ReplyReply Reply with quoteQuote
4  Developments / BASS / Re: vb.net and Streaming [bass 2 icecast] on: 4 Feb '13 - 16:37
I've a question about this code. I use it but it stopping when x = "lenght". In fact, "lenght" = 5292. Because I'm streaming an another stream so there are no remaining time.

Wich the better way to modify this ?

Thank you
ReplyReply Reply with quoteQuote
5  Developments / BASS / Re: Multiple Bass_Mixer_Stream ? on: 29 Jan '13 - 14:47
Thank you radio42 for your response and the explaination. It work perfectly when I split the source.
I continue my project.
ReplyReply Reply with quoteQuote
6  Developments / BASS / Multiple Bass_Mixer_Stream ? on: 29 Jan '13 - 09:08
Hello,

I need to decode one ShoutCast/IceCast stream and duplicate to many encoders ShoutCast/IceCast. Each of else can have one or multiple sound files mixed like this schema :

Playing a stream ShoutCast
               |
               |           Mixing with File #1 ----|
               |                                          |
               |-------------------------------------------> Streaming to IceCast #1
               |
               |           Mixing with File #2 ----|
               |                                          |
               |-------------------------------------------> Streaming to IceCast #2
               |
               |           Mixing with File #3 ----|
               |                                          |
               |-------------------------------------------> Streaming to IceCast #3
               |
               |           Mixing with File #4 ----|
               |                                          |
               |-------------------------------------------> Streaming to IceCast #4
               |
             Etc.

Here is my code, that work for only one stream decode/mixing/encode :

StreamMixed = BassMix.BASS_Mixer_StreamCreate(44100, 2, BASSFlag.BASS_STREAM_DECODE)
StreamIceCast = Bass.BASS_StreamCreateURL(ChannelASource, 0, BASSFlag.BASS_STREAM_DECODE, Nothing, IntPtr.Zero)
BassMix.BASS_Mixer_StreamAddChannel(StreamMixed, StreamIceCast, BASSFlag.BASS_STREAM_AUTOFREE Or BASSFlag.BASS_MIXER_DOWNMIX)
'Here is the code to encode to IceCast/ShoutCast
Bass.BASS_ChannelSlideAttribute(StreamIceCast, BASSAttribute.BASS_ATTRIB_VOL, 0, 1000)
StreamFile = Bass.BASS_StreamCreateFile("c:\test.mp3", 0, 0, BASSFlag.BASS_STREAM_DECODE)
BassMix.BASS_Mixer_StreamAddChannel(StreamMixed, StreamFile, BASSFlag.BASS_STREAM_AUTOFREE Or BASSFlag.BASS_MIXER_DOWNMIX)
Bass.BASS_ChannelSlideAttribute(StreamIceCast, BASSAttribute.BASS_ATTRIB_VOL, 1, 1000)


Thank you for your help
ReplyReply Reply with quoteQuote
7  Developments / BASS / Re: BASS API .NET + System.TypeInitializationException on: 9 Mar '12 - 15:45
No, I'm using Windows XP Pro 32 bit.

But the problem is no longer available since I've reboot my computer Roll Eyes

Thank you for your help.
ReplyReply Reply with quoteQuote
8  Developments / BASS / Re: BASS API .NET + System.TypeInitializationException on: 8 Mar '12 - 14:18
Thank you for your response. I've seen this post.

I'm using 32-bit version of BASS.DLL with Bass.Net for Framework 4.0 and use Visual Basic 2010 Express.
My PC is x86, so... do I have to download DLL for x64 ?
ReplyReply Reply with quoteQuote
9  Developments / BASS / BASS API .NET + System.TypeInitializationException on: 7 Mar '12 - 11:59
Hello,

I use last version of API .NET BASS and BASS.DLL and with the example wich is in the help I've always these errors :
Exception 'System.TypeInitializationException' in my app.exe
Exception 'System.InvalidOperationException' in mscorlib.dll (4 times)
Exception 'System.TypeInitializationException' in my app.exe

I'v BASS.DLL, BASS.NET.XML and BASS.NET.DLL in \bin\Debug. It seems it's a problem with "Imports Un4seen.Bass".

But everything works fine, I listen to the sound, etc.

I don't understand... Can you give me some help, please ?
ReplyReply Reply with quoteQuote
Pages: [1]
Powered by SMF 1.1.18 | SMF © 2013, Simple Machines