Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send audio preview #803

Merged
merged 16 commits into from
Mar 9, 2017
Merged

Send audio preview #803

merged 16 commits into from
Mar 9, 2017

Conversation

Yserz
Copy link
Contributor

@Yserz Yserz commented Feb 23, 2017

Type of change

Sends audio preview when uploading audio data
Adds builder to construct various types of MetaData

Screenshot

image

window.URL.revokeObjectURL url
reject new Error('Exceeded video load timeout')
, 100

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you might wanna reject on error?

, 100

_is_video: (file) ->
file?.type?.startsWith 'video'
Copy link
Contributor

@herrmannplatz herrmannplatz Feb 23, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

underscore is used mostly to used mark private functions

<JSCodeStyleSettings>
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
</JSCodeStyleSettings>
<TypeScriptCodeStyleSettings>
<option name="SPACE_AFTER_TYPE_COLON" value="true" />
</TypeScriptCodeStyleSettings>
<XML>
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dont need to mention that i am not a big fan of committing the ide files :/


_normalise_sample: (value) ->
MAX_VALUE = 255
Math.min(Math.abs(parseInt(value * MAX_VALUE, 10)), MAX_VALUE)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could even move into NumberUtil, its totally generic

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[0...5] will exclude the end

window.setTimeout ->
window.URL.revokeObjectURL url
reject new Error('Exceeded image load timeout')
, 100
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it will resolve and reject. whats the idea behind the timeout

file?.type?.startsWith 'image'

_generate_preview: (audio_buffer) ->
MAX_SAMPLES = 200
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe get_normalized_loudness ?

for bucket, index in buckets
preview[index] = @_normalise_sample(@_root_mean_square(bucket) * AMPLIFIER)
break # only select first channel
new Uint8Array(preview)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so you will use only the left channel for now?

Copy link
Contributor

@bennycode bennycode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't commit changes in yarn.lock.

z.assets.AssetMetaDataBuilder.build_metadata file
.then (metadata) ->
asset = new z.proto.Asset()
if z.assets.AssetMetaDataBuilder.is_audio(file)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if z.assets.AssetMetaDataBuilder.is_audio file

@@ -43,4 +43,4 @@
</option>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</component>
</project>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EOL

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LOL

# Wait before removing resource and link. Needed in FF
window.setTimeout ->
window.URL.revokeObjectURL url
, 100
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we can get rid of this timeout. it was only valid when you actually download a file using the link approach

@Yserz
Copy link
Contributor Author

Yserz commented Mar 9, 2017

yay-merge-all-the-things

@Yserz Yserz merged commit e8cf536 into dev Mar 9, 2017
@Yserz Yserz deleted the send-audio-preview branch March 9, 2017 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants