Git Product home page Git Product logo

shadertone's Introduction

                                                          888
                                                          888
         _ooooooooo._                                     888
      ,o888PP""""PP88   .d88b.  888  888  .d88b.  888d888 888888 .d88b.  88888b.   .d88b.
    d88P''          '  d88""88b 888  888 d8P  Y8b 888P"   888   d88""88b 888 "88b d8P  Y8b
  ,88P                 88    88 Y88  88P 88888888 888     888   88    88 888  888 88888888
 ,88                   Y88..88P  Y8bd8P  Y8b.     888     Y88b. Y88..88P 888  888 Y8b.
,88'                    "Y88P"    Y88P    "Y8888  888      "Y888 "Y88P"  888  888  "Y8888
d8P
d8b                        88[
`88                       J88
 Y8b                     ,88'
  Y8b.                  d88'
   `Y8b._            _o88P
     `Y888oo.____ooo888P'
        '"PP888888PP''

Collaborative Programmable Music.

Overtone is an Open Source toolkit for designing synthesizers and collaborating with music. It provides:

  • A Clojure API to the SuperCollider synthesis engine
  • A growing library of musical functions (scales, chords, rhythms, arpeggiators, etc.)
  • Metronome and timing system to support live-programming and sequencing
  • Plug and play MIDI device I/O
  • A full Open Sound Control (OSC) client and server implementation.
  • Pre-cache - a system for locally caching external assets such as .wav files
  • An API for querying and fetching sounds from http://freesound.org
  • A global concurrent event stream

Quick Start

Installation

  • Install Java, since this is a prerequisite for Clojure

    • Quite often Java will already be installed, if java -version works and shows you a version of 11 or higher you should be good
    • On Linux, you should be able to use your operating system package manager, for instance on Ubuntu the package will be called something like openjdk-17-jdk
    • On MacOS you can use Homebrew if you have it
    • https://adoptium.net/ has installers for most operating systems
  • Install the Clojure CLI tools, see Install Clojure

    • Also install rlwrap if you can, without it clojure will work, but clj will not, and you won't have history and line editing in your Clojure REPL
  • Install SuperCollider, preferrably through your operating system's package manager (apt, yum, pacman, homebrew, chocolatey, etc.)

    • The main package is called supercollider everywhere
    • If there's a package names sc3-plugins, then install that as well

At this point you should have clojure and scsynth available.

$ clojure --version
Clojure CLI version 1.11.1.1413

$ scsynth -v
scsynth 3.13.0 (Built from  '' [na])

Now you can add overtone/overtone as a dependency, and start a Clojure REPL.

mkdir happy-vibes && cd happy-vibes
echo '{:deps {overtone/overtone {:mvn/version "0.14.3199"}}}' > deps.edn
clj

Clojure 1.11.1
user=>

Making sounds

;; boot the server
user=> (use 'overtone.live)
--> Loading Overtone...
[overtone.live] [INFO] Found SuperCollider server: /usr/bin/scsynth (PATH)
--> Booting external SuperCollider server...
--> Connecting to external SuperCollider server: 127.0.0.1:26325
[scynth] SuperCollider 3 server ready.
--> Connection established

;; listen to the joys of a simple sine wave
user=> (demo (sin-osc))

;; or something more interesting...
user=> (demo 7 (lpf (mix (saw [50 (line 100 1600 5) 101 100.5]))
                    (lin-lin (lf-tri (line 2 20 5)) -1 1 400 4000)))

Linter (clj-kondo)

Run overtone.linter/emit! to emit clj-kondo configuration.

Do not commit the generated files, it's a bunch of data.

Detailed Instructions

For a more detailed set of setup instructions (including details specific to Windows and Linux) head over to the Overtone wiki installation page

We maintain documentation for all aspects of the system in the project wiki, you'll find tutorials and examples on topics such as synthesizing new sounds from scratch, live-coding and generating musical scores on the fly. If you see anything missing, please feel free to add it yourself, or hit us up on the mailing list and we'll sort something out.

Cheat Sheet

For a quick glance at all the exciting functionality Overtone puts at your musical fingertips check out the cheat sheet:

https://github.com/overtone/overtone/raw/master/docs/cheatsheet/overtone-cheat-sheet.pdf

Overtone Powered Bands

A list of bands using Overtone to generate sounds:

Community

Mailing List

We encourage you to join the mailing list to see what other people are getting up to with Overtone. Use it to ask questions, show off what you've made and even meet fellow Overtoners in your area so you can meet up for impromptu jam sessions. All we ask is that you be considerate, courteous and respectful and that you share as much of your code as possible so we can all learn how to make crazy cool sounds together.

Clojurians Slack

You can find us in the #overtone channel on Clojurians Slack.

Web

Our main website is hosted on GitHub: http://overtone.github.io

Videos

Introductions

Head over to Vimeo for a fast-paced 4 minute introduction to live-coding with Overtone to see what's possible

http://vimeo.com/22798433

For a nice overview of the basics of creating and playing with synthesized instruments in Overtone checkout Philip Potter's 20 minute workshop:

http://skillsmatter.com/podcast/scala/clojurex-unpanel-2894

Chris Ford also delivers a beautifully paced introduction to fundamental music concepts from basic sine waves to Bach's Goldberg Variations with live examples throughout:

http://skillsmatter.com/podcast/home/functional-composition

There are also the following tutorials:

Presentations

Interviews

Overtone has generated quite a bit of interest. Here's a list of available interviews which go into further depth on the background and philosophy of Overtone:

Performances

Source Repository

Downloads and the source repository can be found on GitHub:

http://github.com/overtone/overtone

Clone the repository on GitHub to get started developing, and if you are ready to submit a patch then fork your own copy and do a pull request.

clojure.tools.deps and Leiningen Support

Overtone and its dependencies are on http://clojars.org, and the dependency for your deps.edn is:

{overtone/overtone {:mvn/version "0.14.3199"}}

or for your project.clj (Leiningen)

[overtone/overtone "0.14.3199"]

Contributors

See: https://github.com/overtone/overtone/graphs/contributors

License

The MIT License, see [[LICENSE]].

Copyright © 2009-2024 Jeff Ross, Sam Aaron, and contributors.

shadertone's People

Contributors

dvberkel avatar johnjelinek avatar josephwilk avatar rogerallen avatar samaaron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

shadertone's Issues

cygwin issue with shader file reloading

On the overtone email list, Andrew Voron reports:

when I call (shadertone.shader/start "examples\raymarching1.glsl") - all updates fine on windows.

[But with "examples/raymarching1.glsl"] Code fails in the function

(defn- if-match-reload-shader
  [files]
  (if @watcher-just-started
    ;; allow first, automatic call to pass unnoticed
    (swap! watcher-just-started (fn [x] false))
    ;; otherwise do the reload check
    (doseq [f files]
      (when (= (.getPath f) (:shader-filename @globals))
        ;; set a flag that the opengl thread will use
        (dosync (ref-set reload-shader true))))))

when it trys to compare (.getPath f) and (:shader-filename @Globals)

Leiningen version < 2.4.3 trouble

I've updated my Mac to OS X Mavericks 10.9.4 and now I can't run shadertone past v0.2.2. I think this may be a 10.9 issue, not a 10.9.x issue, but I'm still figuring this out.

The error reported is:

Exception in thread "main" java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1886)
    at java.lang.Runtime.loadLibrary0(Runtime.java:849)
    at java.lang.System.loadLibrary(System.java:1088)
    at org.lwjgl.Sys$1.run(Sys.java:73)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.lwjgl.Sys.doLoadLibrary(Sys.java:66)
    at org.lwjgl.Sys.loadLibrary(Sys.java:95)
    at org.lwjgl.Sys.<clinit>(Sys.java:112)
    at org.lwjgl.opengl.Display.<clinit>(Display.java:135)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:190)
    at shadertone.shader$eval10112$loading__4910__auto____10113.invoke(shader.clj:1)
    at shadertone.shader$eval10112.invoke(shader.clj:1)
...

This tag uses the older release of lwjgl v2.9.0 instead of v2.9.1.

I've also updated Java & Lein, but I don't think that's it.
Leiningen 2.4.2 on Java 1.7.0_60 Java HotSpot(TM) 64-Bit Server VM

Add :previousFrame texture input

Using the previously rendered frame as a texture source would enable interesting blend effects.

It would also be a way for the fragment shader to create and use some "state" of its own.

This should be pretty simple:

glGenTextures(1,&img);

& after rendering, save backbuffer contents into texture

glBindTexture(GL_TEXTURE_2D,img);
glCopyTexSubImage2D(GL_TEXTURE_2D,0,0,0,0,0,width,height);

Clojure -> GLSL translation

Transferring this issue from original repository rogerallen#9

Sam Aaron suggested:
Another interesting option would be to write a transpiler from Clojure to glsl code.

Karsten Schmidt followed up with:
Re: Sam's comment about a CLJ -> GLSL compiler: Zach Tellman's old
Penumbra project has a mention of something like that, though I can't
comment on if or how well it works:

See here:
https://github.com/ztellman/penumbra/tree/master/src/penumbra/glsl

From the forum
On Thu, Apr 4, 2013 at 1:40 AM, Stathis [email protected] wrote:
I may be a bit late to the party, but the "transpiler" bit for generating GLSL code from Clojure has already been implemented in Penumbra which is no longer in development, but maybe could be cannibalised? Here is an example of a shader written in "clojure" code that's translated to GLSL by this part of Penumbra.

Stathis

And finally, the original author also mentioned:

Speaking as the person who wrote the GLSL transpilation, I'd recommend against using the Penumbra code wholesale. The type inference is finicky, and the implementation is fairly opaque. However, if you have any questions about what's going on there, feel free to get in touch. I don't guarantee I remember enough to answer everything, but I can at least point you in the right direction.

Zach

So, when I get ready to do this, I'll follow up with Zach

Version 0.1.0 Tracking

Bringing rogerallen#15 to this repository.

Tracking random issues to take care of before a Version 0.1.0 release.

  • documentation
  • demos
  • blog-entry
  • clojars

for a 0.1.0 release.

Then:

  • create "dev" branch

INTEL gpu black screen when running Shadertone

Hi,

I'm using OS X maverick. I cloned the project and ran a repl (Clojure 1.5.1). Also ran lein run

I could not get any of the examples to work.
It launches a main window but it is always black. I think I've been through ever example with the sample result.

Am I doing something wrong?

I also tried the https://github.com/rogerallen/sot project and had the same black window.

Java info:
java version "1.7.0_40"
Java(TM) SE Runtime Environment (build 1.7.0_40-b43)
Java HotSpot(TM) 64-Bit Server VM (build 24.0-b56, mixed mode)

Thanks,
Joseph Wilk

Recovering from errors

Problem

Live editing shaders risks causing errors which (as far as I can see) can only be rectified with a JVM restart.

Details

When live editing a shader sometimes I mess up and do something illegal. Some errors do not cause any problems and we can fix them in the shader.

Example:

Reloading shader: resources/shaders/amp.glsl
ERROR: Loading a Shader:
ERROR: 0:345: Use of undeclared identifier 'noise'

ERROR: Linking Shaders:
ERROR: One or more attached shaders not successfully compiled

However some errors such as the one below raise an error that renders the shader unresponsive (we cannot just call stop).

Loading shader from file: resources/shaders/amp.glsl
ERROR: Loading a Shader:
ERROR: 0:229: Missing return for function 'generateSpacey'
ERROR: 0:333: Call to undeclared function 'generateSpace'

ERROR: Linking Shaders:
ERROR: One or more attached shaders not successfully compiled

Exception in thread "Thread-3960" java.lang.Exception: OpenGL Error(1282):GL_INVALID_OPERATION: @ end of let init-shaders
    at shadertone.shader$except_gl_errors.invoke(shader.clj:38)
    at shadertone.shader$init_shaders.invoke(shader.clj:258)
    at shadertone.shader$init_gl.invoke(shader.clj:413)
    at shadertone.shader$run_thread.invoke(shader.clj:630)
    at shadertone.shader$start_shader_display$fn__13715.invoke(shader.clj:837)
    at clojure.lang.AFn.run(AFn.java:24)
    at java.lang.Thread.run(Thread.java:744)

Suggestions?

Is it possible to restart the shader without a jvm restart?

Happy to have a go at hacking this is there is a viable solution.

Document usage for people who don't know clojure

I've never used clojure, and when I read the Usage section of README.md, I just can't get how to run Shadertone.

It may be trivial for people who know how ton compile/install/run a clojure project but for people who don't know it, it's not easy.

I tried to use lein since I've seen it is a clojure compiling utility but I can't get it work.

03demo_translate causes crash

Hi Roger (and other developers)

I've been using shadertone for a while. Now I updated my Linux to use proprietary driver (AMD Catalyst) and it's working wonderfully on my Fedora 21 GNOME, believe it or not (better perfomance etc.) But now I bump into a new problem, when swapping values in shaders, I always bump into the same error. I believe maybe since my new OpenGL version is now 4.4 then it could be that GL20 libraries dont work as they should?

Anyhow when using swap! in demo03 I get this error message (and in many other sceneros as well)
But I know this error would not have been reproduce-able before I installed the Catalyst Driver.

Loading shader from string
Reloading shader: nil
Exception in thread "Thread-6" org.lwjgl.opengl.OpenGLException: Invalid operation (1282)
    at org.lwjgl.opengl.Util.checkGLError(Util.java:59)
    at org.lwjgl.opengl.GL20.glUniform3f(GL20.java:356)
    at shadertone.shader$draw.invoke(shader.clj:599)
    at shadertone.shader$update.invoke(shader.clj:697)
    at shadertone.shader$run_thread.invoke(shader.clj:728)
    at shadertone.shader$start_shader_display$fn__3628.invoke(shader.clj:935)
    at clojure.lang.AFn.run(AFn.java:24)
    at java.lang.Thread.run(Thread.java:745)

Linux amd64 linking troubles (wrong ELF class: ELFCLASS32)

From the forum: https://groups.google.com/forum/?fromgroups=#!topic/overtone/7bQSJUUviBw

Hi,

I'm trying to get Shadertone working, but can't! I followed the instructions on the github (https://github.com/overtone/shadertone), but was unclear on how to run the project. I read the usage section but couldn't figure it out, so I decided to try lein repl to see if that would work. It didn't because I can't even load the overtone library without it crashing (something which I tested and can safely do in a new lein project). I recorded a terminal session of this and put it here: http://pastebin.com/raw.php?i=aqKebm0p.

Am I running the project incorrectly? Is this something wrong with my computer's configuration? Any help is greatly appreciated!

-Kane


The pastebin has this clue:

*** ERROR: dlsym load err '/home/chris/shadertone/target/native/linux/x86_64/libscsynth.so: undefined symbol: load'
Found 0 LADSPA plugins
*** ERROR: dlsym load err '/home/chris/shadertone/target/native/libopenal64.so: undefined symbol: load'
*** ERROR: dlsym load err '/home/chris/shadertone/target/native/liblwjgl64.so: undefined symbol: load'
*** ERROR: dlopen '/home/chris/shadertone/target/native/liblwjgl.so' err '/home/chris/shadertone/target/native/liblwjgl.so: wrong ELF class: ELFCLASS32'

Something is up with the mixture of elf32 and elf64 libs

add pixel read feature

From a discussion on the google group:
https://groups.google.com/forum/?fromgroups#!topic/overtone/cVIZKiZRuwk

Circu Virtu asks:

Some new questions pop into my mind:

Is there any way to get pixel data back from the shader into overtone (creating , controlling music from grafic data) ??

That's just a glReadPixels call, so it isn't too difficult to add. The amount of data could be significant, though and I'd like to hear more about how you'd intend to use it.

Good to hear that there is a possible solution. I'm not interested in getting all Pixel data. I'm most interested in just values of single pixels or means of small pixel areas. See them as sensors for brightness and/or color of the image.
The computing power of the shader is amazing. That way one can get data back to overtone to control parameters fro music.
And even better one then can create recursive/iterrative loops like: sound changes images -> images change sound -> sound changes images -> and so on.

Would love to have an easy to use interface to access glPixel.

Demo 02 has a typo?

when running demo 02 in the examples directory, this threw an error:

(t/start "examples/disco.glsl"
:width 800 :height 600
:textures [:iOvertoneAudio])

this worked:
(t/start "examples/disco.glsl"
:width 800 :height 600
:textures [:overtone-audio])

Difficulty Running Shadertone

Hey! I was investigating this project because it looked pretty cool. I was running into an error - 'libjawt.so: cannot open shared object file: No such file or directory'. I'm not sure what the problem was, but I tried to fix it by bumping dependency versions and although that did work it was quite a process. I kept a journal.

Is there any appetite to update Shadertone to use Overtone 0.13.3177? That will lose the buffer-data function and probably trigger the performance issues in #34 but at least the demo will be easier to run on a newly setup machine.

LWJGL 2.9.0 window positioning issue

LWJGL/lwjgl#27

describes the issue I'm having when I updated to 2.9.0 from 2.8.5 -- the window pops up in the lower-left instead of the upper left. It's like the origin changed...

I'm going to go back to 2.8.5 because the older behavior seems right. We'll see what happens on that bug...

Use Overtone 0.9.0

Overtone is updating to 0.9.0. RC2 is out. This will track any issues.

c1c0d7a has the first fixes for this.

add iChannelResolution

Shadertoy 0.3.1 added this.

uniform vec3 iChannelResolution[4]; // channel resolution (in pixels)

each texture (of 4) has width, height and 1.0 in the vec3
default is 0.0 for w/h/d
cubemap keeps defaults.

shadertone does not play audio or video textures

Bringing this issue over from the original repo: rogerallen#12

Shadertone does not decode audio or video "textures" like the www.shadertoy.com website.

This is something that would be nice to have, but since the main use case I'm focused on is Overtone, I'm satisfied to only take that as the only audio input for now.

For movies, a quick search for code seemed to describe a "bag of hurt" to decode video textures. I'd rather focus on other features first.

So, for now I'll list the issue and place this in the "wontfix" category.

I will certainly consider pull requests or pointers to code that would help add this easily.

Shaders and RAM usage

Hello, this is not a issue or a bug, but a thought about possible enhancement. I've noticed when reloading shaders the process "Java" can reach up to 7-8gb of RAM usage, thus slowing everything down. I can post an extract from the code I'm using, but in general, I think this is caused by not deleting zombies and/or past information. But could be caused by other factors in my code. I usually use midi for VJ-ing.

  (def SHADER1 "
  uniform float iGlobalTime;
uniform vec3 iResolution;
uniform vec3 i13;
uniform float i4;
uniform vec3 i57;
uniform float i8;
uniform float iOvertoneVolume;
uniform sampler2D iChannel0;
//  #define time  iGlobalTime
//  #define R iResolution.xy
void main(void)
{

   //vec2 pos = (gl_FragCoord.xy/iResolution.xy) * 8. - 4.;
   vec2 pos = (gl_FragCoord.xy/iResolution.xy) * (10.*i4) - (5.*i57.x);
    pos.x *= iResolution.x / iResolution.y;
    float s = (.25*i57.y), f = .0, k = f;
    vec3 p = vec3(pos, sin(iOvertoneVolume* iGlobalTime * i13.x) * i13.y - i13.z)* s;

    for( int i=0; i< 10; i++ )
    {
           p = abs(p)/dot(p,p)- (1.65*i57.z);
           k = length(p) ;
           p = p*k+k;
   }

   f = dot(p,p)* s;
   gl_FragColor= vec4(f*.5, f *(1.2*i8), f * (5.*i8), 1.);;
}
")

(def shaderut (atom SHADER1))

(def MPKmini (midi-find-connected-device "MPK mini"))
(def i13 (atom [0.5 0.5 0.5]))
(def i4   (atom [0.15]))
(def i57 (atom [0.5 0.5 0.5]))
(def i8   (atom [0.5]))

(on-event (conj (midi-mk-full-device-key MPKmini) :control-change)
          (fn [m] (let [test (:data1 m)]
                   (case test
                     1 (swap! i13  assoc 0 (/ (:data2 m) 127))
                     2 (swap! i13  assoc 1 (/ (:data2 m) 127))
                     3 (swap! i13  assoc 2 (/ (:data2 m) 127))
                     4 (swap! i4   assoc 0 (/ (:data2 m) 127))
                     5 (swap! i57  assoc 0 (/ (:data2 m) 127))
                     6 (swap! i57  assoc 1 (/ (:data2 m) 127))
                     7 (swap! i57  assoc 2 (/ (:data2 m) 127))
                     8 (swap! i8   assoc 0 (/ (:data2 m) 127))
                     nil)))
          ::MPK-knobs)

(on-event [:midi :note-on]
           (fn [m] (let [test (:note m)]
                    (case test
                      48 (reset! shaderut SHADER1)
                      49 (reset! shaderut  SHADER2)
                      50 (reset! shaderut  SHADER3)
                      51 (reset! shaderut  SHADER4)
                      52 (reset! shaderut  SHADER6)
                      nil)))
           ::MPK-keys))

(defmacro glsl_boot [] (t/start shaderut
                                :width 800
                                :height 600
                                :textures [:overtone-audio]
                                :user-data {
                                                 "i13" i13
                                                 "i4" i4
                                                 "i57" i57
                                                 "i8" i8
                                                 }))
;Start the Shaders
(comment (glsl_boot))

Shader Translation

This is not really an issue or error, just a minor bug. I was trying out the glsl translate functions and noticed how some of the parenthesis are translated wrongly. Maybe there's nothing wrong with this and my code is just wrong. I'll just post the code and maybe you can tell me what's wrong, translation or not.

So I wanted to take this shadertoy shader https://www.shadertoy.com/view/ldBGRR

void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
    vec2 p = -1.0 + 2.0 * fragCoord.xy / iResolution.xy;

// main code, *original shader by: 'Plasma' by Viktor Korsun (2011)
float x = p.x;
float y = p.y;
float mov0 = x+y+cos(sin(iGlobalTime)*2.0)*100.+sin(x/100.)*1000.;
float mov1 = y / 0.9 +  iGlobalTime;
float mov2 = x / 0.2;
float c1 = abs(sin(mov1+iGlobalTime)/2.+mov2/2.-mov1-mov2+iGlobalTime);
float c2 = abs(sin(c1+sin(mov0/1000.+iGlobalTime)+sin(y/40.+iGlobalTime)+sin((x+y)/100.)*3.));
float c3 = abs(sin(c2+cos(mov1+mov2+c2)+cos(mov2)+sin(x/1000.)));
fragColor = vec4(c1,c2,c3,1);

}   

And make the following translation function

(trans/defshader simple2
  '((uniform vec3 iResolution)
    (uniform float iGlobalTime)
    (defn void main []
      (setq vec2 p (- 1.0 (/ (* 2. gl_FragCoord.xy) iResolution.xy)))
      (setq float x p.x)
      (setq float y p.y)
      (setq float mov0 (+ x y (* 100. (cos (* 2.0 (sin iGlobalTime))))
                          (* 1000. (sin (/ x 100.)))))
      (setq float mov1 (+ iGlobalTime (/ y 0.9)))
      (setq float mov2 (/ x 0.2))
      (setq float c1 (abs (sin (+ (/ (+ mov1 iGlobalTime) 2.)
                                  (/ mov2 2.)
                                  (- mov1)
                                  (- mov2)
                                  iGlobalTime))))
      (setq float c2 (abs (sin (+ (+ c1 (sin (/ mov0 (+ iGlobalTime 1000.))))
                                  (sin (/ y (+ 40. iGlobalTime)))
                                  (sin (* (/ (+ x y) 100.) 3.0))))))
      (setq float c3 (abs (sin (+ c2
                                  (cos (+ mov1 mov2 c2))
                                  (cos mov2)
                                  (sin (/ x 1000.))))))
      (setq gl_FragColor (vec4 c1 c2 c3 1.0))))) 

It will output a shader, but not like the one on shadertoy, they look different. Also the print function prints out the following, making all these extra parenthesis suspicious.

uniform vec3 iResolution;
uniform float iGlobalTime;
void main(void) {
vec2 p = (1.0 - ((2.0 * gl_FragCoord.xy) / iResolution.xy));
float x = p.x;
float y = p.y;
float mov0 = (x + y + (100.0 * cos((2.0 * sin(iGlobalTime)))) + (1000.0 * sin((x / 100.0))));
float mov1 = (iGlobalTime + (y / 0.9));
float mov2 = (x / 0.2);
float c1 = abs(sin((((mov1 + iGlobalTime) / 2.0) + (mov2 / 2.0) + (mov1) + (mov2) + iGlobalTime)));
float c2 = abs(sin(((c1 + sin((mov0 / (iGlobalTime + 1000.0)))) + sin((y / (40.0 + iGlobalTime))) + sin((((x + y) / 100.0) * 3.0)))));
float c3 = abs(sin((c2 + cos((mov1 + mov2 + c2)) + cos(mov2) + sin((x / 1000.0)))));
gl_FragColor = vec4(c1,c2,c3,1.0);
}

update directory watcher

transferring this issue from original repository: rogerallen#10

If a user starts with "another/path/to/shader.glsl", Shadertone should watch that new path for updates.


The watcher code does not seem to be capable of restarting as-is. So I would need to potentially add this to the code...not looking to bite off that work at this point.

For the moment, I just have the "shaders" and "examples" directory in the list I watch.

"Good Enough" but not the best solution.

starting a glsl with user-data breaks the volume tap

Here is the call I am making to start my glsl file:

(t/start "visualizer/visualizer.glsl"
:textures [:overtone-audio :previous-frame]
:width 800
:height 600
:title "Graphics!"
:user-data { "iBeat" iBeat})

When this is called, the iOvertoneVolume variable in my glsl file is always zero. I test this with:

gl_FragColor = vec4(iOvertoneVolume,0,0,1);

The screen is always black. However, if I start my glsl file with this:

(t/start "visualizer/visualizer.glsl"
:textures [:overtone-audio :previous-frame]
:width 800
:height 600
:title "Graphics!") // note omitted line

The screen pulses nicely red with input volume.

FFT data seems strange (vastly different to shadertoy.com)

I was having trouble porting some shaders from shadertoy.com and after some investigating it looks like the FFT part of :overtone-audio is either incorrect or just somehow quite different to shaertoy.com

This video contains a short demo of what I found: https://www.youtube.com/watch?v=3HWCf0sXXtg

Some observations:

  • no issues with the waveform 👍 -> waveform is from -1 to 1 instead of 0 to 1 (or was it the other way around? - either way, shadertoy.com is one and shadertone is the other)
  • many 'missing' frequencies
    • especially high ones
  • red bar with resolution at 512, doesn't happen with the default of 4096
  • the freqs that are there are often displayed as louder than in shadertoy.com

Unfortunately this makes most shaders I found useless since they don't work that well as is (very 'jumpy'/ jittery).

Maybe this is also an issue with my setup as I didn't see anyone else having this kind of problem here (maybe related to #34 / external SC).

This is my current setup on Ubuntu with Jack and external SC:
image

Edit: the red bar to the right made me curious, so I tried using 1024 as width:
image

It's sort of strange that the waveform falls to the bottom on shadertoy.com but just continues straight with shadertone - but I'm not exactly sure what to make of it.

Add :user-data to shader.clj

There's no reason to keep this in the shadertone.tone namespace. It would be useful in the shadertone.shader namespace, too.

iChannelTime is the same as iGlobalTime

Bringing this issue over from the original repository: rogerallen#13

There isn't an API to start and stop audio or movies, so iChannelTime[0..3] are currently all equal to iGlobalTime.

I'll consider fixing this if issue #3 is ever fixed. Until then, this goes into the wontfix category.

add keyboard input

Added in shadertoy 0.3.2

First row of texels contain the current instantaneous state of the 256 keys.
The second row contains a toggle for every key.
Horizontal texel positions correspond to ASCII codes.

Press arrow keys to test this example here https://www.shadertoy.com/view/lsXGzf

Multiple shadertones

Figure out a way to allow for multiple windows to stay open.

It is convenient to have start use one window as the default, though.

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.