Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
rapid-mix
eNterface2017_examples
Commits
700b9b25
Commit
700b9b25
authored
Jul 05, 2017
by
Joseph Larralde
Browse files
cosmetics
parent
19100e71
Changes
2
Hide whitespace changes
Inline
Side-by-side
wavesjs-etc/03_mobile-kick.html
View file @
700b9b25
<!DOCTYPE html>
<html>
<head>
<title>
COMO mouse gestures
</title>
<meta
charset=
"utf-8"
>
<script
type=
"text/javascript"
src=
"https://como.ircam.fr/motion-features.min.js"
></script>
<script
type=
"text/javascript"
src=
"https://como.ircam.fr/waves-loaders.min.js"
></script>
<style>
div
{
margin
:
0
auto
;
}
<title>
COMO mouse gestures
</title>
<meta
charset=
"utf-8"
>
<script
type=
"text/javascript"
src=
"https://como.ircam.fr/motion-features.min.js"
></script>
<script
type=
"text/javascript"
src=
"https://como.ircam.fr/waves-loaders.min.js"
></script>
<style>
div
{
margin
:
0
auto
;
}
button
{
display
:
inline-block
;
width
:
100%
;
height
:
50px
;
padding
:
20px
;
margin-bottom
:
10px
;
}
</style>
button
{
display
:
inline-block
;
width
:
100%
;
height
:
50px
;
padding
:
20px
;
margin-bottom
:
10px
;
}
</style>
</head>
<body>
<button
id=
"unlock"
>
unlock audio
</button>
<script
type=
"text/javascript"
>
/* globals motionFeatures */
/* globals wavesLoaders */
var
audioContext
;
try
{
audioContext
=
new
webkitAudioContext
();
}
catch
(
e
)
{
audioContext
=
new
AudioContext
();
}
var
audioFiles
=
[
'
./assets/1_808-kick_long.wav
'
,
'
./assets/2_808-hh_closed.wav
'
,
'
./assets/3_808-SD1.wav
'
,
'
./assets/4_808-hh_open.wav
'
];
// this is for iOS !!!! (need user action to enable audio playback)
var
locked
=
true
;
var
b
=
document
.
querySelector
(
'
#unlock
'
);
b
.
addEventListener
(
'
click
'
,
function
(
e
)
{
// console.log('click');
if
(
locked
)
{
var
buffer
=
audioContext
.
createBuffer
(
1
,
1
,
22050
);
var
source
=
audioContext
.
createBufferSource
();
source
.
buffer
=
buffer
;
source
.
connect
(
audioContext
.
destination
);
source
.
start
();
locked
=
false
;
console
.
log
(
'
audio unlocked !
'
);
b
.
style
.
backgroundColor
=
'
#0f0
'
;
}
});
var
loader
=
new
wavesLoaders
.
AudioBufferLoader
();
loader
.
load
(
audioFiles
).
then
(
function
(
loaded
)
{
var
counter
=
0
;
<button
id=
"unlock"
>
unlock audio
</button>
<script
type=
"text/javascript"
>
/* globals motionFeatures */
/* globals wavesLoaders */
var
audioContext
;
try
{
audioContext
=
new
webkitAudioContext
();
}
catch
(
e
)
{
audioContext
=
new
AudioContext
();
}
var
audioFiles
=
[
'
./assets/1_808-kick_long.wav
'
,
'
./assets/2_808-hh_closed.wav
'
,
'
./assets/3_808-SD1.wav
'
,
'
./assets/4_808-hh_open.wav
'
,
];
// this is for iOS !!!! (need user action to enable audio playback)
var
locked
=
true
;
var
b
=
document
.
querySelector
(
'
#unlock
'
);
b
.
addEventListener
(
'
click
'
,
function
(
e
)
{
// console.log('click');
if
(
locked
)
{
var
buffer
=
audioContext
.
createBuffer
(
1
,
1
,
22050
);
var
source
=
audioContext
.
createBufferSource
();
source
.
buffer
=
buffer
;
source
.
connect
(
audioContext
.
destination
);
source
.
start
();
locked
=
false
;
console
.
log
(
'
audio unlocked !
'
);
b
.
style
.
backgroundColor
=
'
#0f0
'
;
}
});
var
loader
=
new
wavesLoaders
.
AudioBufferLoader
();
loader
.
load
(
audioFiles
).
then
(
function
(
loaded
)
{
var
counter
=
0
;
var
mf
=
new
motionFeatures
.
MotionFeatures
({
descriptors
:
[
'
accIntensity
'
,
'
kick
'
],
kickThresh
:
20
,
kickCallback
:
kick
,
});
var
mf
=
new
motionFeatures
.
MotionFeatures
({
descriptors
:
[
'
accIntensity
'
,
'
kick
'
],
kickThresh
:
20
,
kickCallback
:
kick
,
});
window
.
addEventListener
(
'
devicemotion
'
,
function
(
e
)
{
var
x
=
e
.
accelerationIncludingGravity
.
x
;
var
y
=
e
.
accelerationIncludingGravity
.
y
;
var
z
=
e
.
accelerationIncludingGravity
.
z
;
mf
.
setAccelerometer
(
x
,
y
,
z
);
mf
.
update
();
});
function
kick
(
res
)
{
var
indexArray
=
[
0
,
1
,
2
,
1
];
var
index
=
indexArray
[
counter
];
var
buf
=
audioContext
.
createBufferSource
();
buf
.
buffer
=
loaded
[
index
];
buf
.
connect
(
audioContext
.
destination
);
buf
.
start
();
counter
=
(
counter
+
1
)
%
4
;
}
window
.
addEventListener
(
'
devicemotion
'
,
function
(
e
)
{
var
x
=
e
.
accelerationIncludingGravity
.
x
;
var
y
=
e
.
accelerationIncludingGravity
.
y
;
var
z
=
e
.
accelerationIncludingGravity
.
z
;
mf
.
setAccelerometer
(
x
,
y
,
z
);
mf
.
update
();
});
</script>
function
kick
(
res
)
{
var
indexArray
=
[
0
,
1
,
2
,
1
];
var
index
=
indexArray
[
counter
];
var
buf
=
audioContext
.
createBufferSource
();
buf
.
buffer
=
loaded
[
index
];
buf
.
connect
(
audioContext
.
destination
);
buf
.
start
();
counter
=
(
counter
+
1
)
%
4
;
}
});
</script>
</body>
</html>
\ No newline at end of file
wavesjs-etc/index.html
View file @
700b9b25
...
...
@@ -62,10 +62,18 @@
<h2>
links to docs
</h2>
<ul>
<li><a
href=
"http://wavesjs.github.io/"
>
wavesjs documentation
</a></li>
<li><a
href=
"https://github.com/Ircam-RnD/xmm-node"
>
xmm-node documentation
</a></li>
<li><a
href=
"https://ircam-rnd.github.io/xmm-client/"
>
xmm-client documentation
</a></li>
<li><a
href=
"https://github.com/Ircam-RnD/motion-features"
>
motion-features documentation
</a></li>
<li><a
href=
"http://wavesjs.github.io/"
target=
"_blank"
>
wavesjs documentation
</a></li>
<li><a
href=
"https://github.com/Ircam-RnD/xmm-node"
target=
"_blank"
>
xmm-node documentation
</a></li>
<li><a
href=
"https://ircam-rnd.github.io/xmm-client/"
target=
"_blank"
>
xmm-client documentation
</a></li>
<li><a
href=
"https://github.com/Ircam-RnD/motion-features"
target=
"_blank"
>
motion-features documentation
</a></li>
</ul>
</div>
</body>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment