Code Monkey home page Code Monkey logo

transforms's People

Contributors

glaslos avatar mattetti avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

transforms's Issues

Trying to pan from left to right

Hey, I'm trying to pan from left to right, borrowing from your StereoPan function. The follow doesn't error out but doesn't play anything... Any idea why? Thanks

func Panning(buf *audio.FloatBuffer, rate float64) error {
	if buf == nil || buf.Format == nil || buf.Format.NumChannels != 2 {
		return audio.ErrInvalidBuffer
	}

	step := 1 / rate

	for a, pan := 0.0, 0.0; a <= rate; a += 1.0 {
		switch {
		case pan == 0.5:
			fmt.Println(a, " | ", pan, " | N")
		case pan < 0.5:
			fmt.Println(a, " | ", pan, " | L")
			for i := 0; i+2 <= len(buf.Data); i += 2 {
				buf.Data[i+1] *= (pan * 2)
			}
		case pan > 0.5:
			fmt.Println(a, " | ", pan, " | R")
			for i := 0; i+2 <= len(buf.Data); i += 2 {
				buf.Data[i] *= ((1 - pan) * 2)
			}
		}
		pan += step
	}
	return nil
}```

sample rate conversion ?

Hi,
This is question, i don't find any function to convert sample rate (ie from 44100 to 48000),
is there any way to do this with go-audio ?
Regards

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.